I am using an external project to download and build a third-party library from GitHub. This works fine, except that every time, I run make, the configure and build parts of the external project run, even though nothing has changed. Here is the relevant CMake code:
================================= include(ExternalProject) set(JEMALLOC_PREFIX_DIR ${CMAKE_BINARY_DIR}/Jemalloc) set(JEMALLOC_SRC_DIR ${JEMALLOC_PREFIX_DIR}/src/Jemalloc) set(JEMALLOC_INSTALL_DIR ${JEMALLOC_PREFIX_DIR}/install) ExternalProject_Add(Jemalloc GIT_REPOSITORY https://github.com/jemalloc/jemalloc.git GIT_TAG master PREFIX ${JEMALLOC_PREFIX_DIR} CONFIGURE_COMMAND echo Configuring jemalloc && cd ${JEMALLOC_SRC_DIR} && ./autogen.sh && ./configure --prefix=${JEMALLOC_INSTALL_DIR} --with-jemalloc-prefix=je_ --enable-prof BUILD_COMMAND echo Building jemalloc && cd ${JEMALLOC_SRC_DIR} && make install_lib_static install_include INSTALL_COMMAND "" ) # Create libjemalloc and libjemalloc-pic targets to be used as # dependencies add_library(libjemalloc STATIC IMPORTED GLOBAL) add_library(libjemalloc-pic STATIC IMPORTED GLOBAL) set_target_properties(libjemalloc PROPERTIES "IMPORTED_LOCATION" "${JEMALLOC_INSTALL_DIR}/lib/libjemalloc.a") set_target_properties(libjemalloc-pic PROPERTIES "IMPORTED_LOCATION" "${JEMALLOC_INSTALL_DIR}/lib/libjemalloc-pic.a") # Make the targets depend on the external project download. add_dependencies(libjemalloc Jemalloc) add_dependencies(libjemalloc-pic Jemalloc) # Export the include directory path. set(JEMALLOC_INCLUDE_DIR ${JEMALLOC_INSTALL_DIR}/include) ================================= When I run this for the first time, the library code is pulled from Git and built. The second time around, I see this: [ 13%] Performing update step for 'Jemalloc' Current branch master is up to date. [ 18%] Performing configure step for 'Jemalloc' Configuring jemalloc autoconf ./configure --enable-autogen I really don't want anything to be rebuilt if there are no changes in the source repository. What am I doing wrong?
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake