On 10/12/2011 10:22 PM, Lori Pritchett-Sheats wrote: > > I'm building external packages in my CMake system using the > ExternalPackages_Add function. When a package is built this way and I > execute a 'make clean' at the top of my build tree, all targets are > cleaned including the external packages. Is there a way to remove the > external package targets from the the default clean target?
The following exemplary project does not exhibit this behavior: # CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(CLEAN C) SET(CMAKE_VERBOSE_MAKEFILE ON) INCLUDE(ExternalProject) ExternalProject_Add(external SOURCE_DIR ${CMAKE_SOURCE_DIR}/external CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>) FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n") ADD_EXECUTABLE(main main.c) ADD_DEPENDENCIES(main external) INSTALL(TARGETS main DESTINATION bin) # external/CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(EXTERNAL C) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/f.c "void f(void){}\n") ADD_LIBRARY(f SHARED f.c) INSTALL(TARGETS f DESTINATION lib) After configuring and building: % ls main external-prefix/src/external-build/libf.so external-prefix/src/external-build/libf.so main After "make clean" in CMAKE_BINARY_DIR: % ls main external-prefix/src/external-build/libf.so ls: cannot access main: No such file or directory external-prefix/src/external-build/libf.so The top-level project's target is gone whereas the external project's one is intact, and [1] reports the same, i.e. the opposite of your concern. Thus, could you boil down your issue to a minimal but self-contained example for further investigation? Regards, Michael [1] http://www.mail-archive.com/cmake@cmake.org/msg35411.html -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake