[CMake] Need help with ExternalProject_Add file dependencies

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu May 30 05:22:44 EDT 2013


I would like to add a build system (Copy a single CMakeLists.txt file
to the unpacked source tree) to an external project build with a
proper file dependency on the source CMakeLists.txt file so
if that file is changed (or touched) a complete rebuild occurs.

Here is how I am attempting to do this:

ExternalProject_Add(
     build_shapelib
     URL http://download.osgeo.org/shapelib/shapelib-1.3.0.tar.gz
     URL_MD5 2ff7d0b21d4b7506b452524492795f77
     CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${EP_BASE}/Install/build_shapelib -DEG_DATA:PATH=${EP_BASE}/Source/build_shapelib/eg_data
     TEST_BEFORE_INSTALL ON
     TEST_COMMAND ctest
     STEP_TARGETS download update_build_system download_eg_data clean_unpacked_eg_data unpack_eg_data configure build install test
     )

   add_custom_command(
     OUTPUT ${EP_BASE}/Source/build_shapelib/CMakeLists.txt
     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/shapelib/CMakeLists.txt ${EP_BASE}/Source/build_shapelib/CMakeLists.txt
     DEPENDS
     ${CMAKE_SOURCE_DIR}/shapelib/CMakeLists.txt
     )
   ExternalProject_Add_Step(build_shapelib update_build_system
     COMMENT "Updating build system"
     DEPENDS ${EP_BASE}/Source/build_shapelib/CMakeLists.txt
     DEPENDERS configure
     ALWAYS OFF
     )

   ExternalProject_Add_Step(build_shapelib [...]

   The remaining elided steps finish the complete external build but
   are not relevant to the file dependency issue I appear to be
   encountering.



More information about the CMake mailing list