<div dir="ltr">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:<br><div class="gmail_quote"><div dir="ltr"><div> </div><div>=================================</div><div><div>include(ExternalProject)</div><div><br></div><div>set(JEMALLOC_PREFIX_DIR ${CMAKE_BINARY_DIR}/Jemalloc)</div><div>set(JEMALLOC_SRC_DIR ${JEMALLOC_PREFIX_DIR}/src/Jemalloc)</div><div>set(JEMALLOC_INSTALL_DIR ${JEMALLOC_PREFIX_DIR}/install)</div><div><br></div><div>ExternalProject_Add(Jemalloc</div><div>        GIT_REPOSITORY      <a href="https://github.com/jemalloc/jemalloc.git" target="_blank">https://github.com/jemalloc/jemalloc.git</a></div><div>        GIT_TAG             master</div><div>        PREFIX              ${JEMALLOC_PREFIX_DIR}</div><div>        CONFIGURE_COMMAND   echo Configuring jemalloc</div><div>                            && cd ${JEMALLOC_SRC_DIR}</div><div>                            && ./autogen.sh && ./configure --prefix=${JEMALLOC_INSTALL_DIR} --with-jemalloc-prefix=je_ --enable-prof</div><div>        BUILD_COMMAND       echo Building jemalloc && cd ${JEMALLOC_SRC_DIR}</div><div>                            && make install_lib_static install_include</div><div>        INSTALL_COMMAND     ""</div><div>)</div><div><br></div><div># Create libjemalloc and libjemalloc-pic targets to be used as</div><div># dependencies</div><div>add_library(libjemalloc STATIC IMPORTED GLOBAL)</div><div>add_library(libjemalloc-pic STATIC IMPORTED GLOBAL)</div><div><br></div><div>set_target_properties(libjemalloc PROPERTIES</div><div>        "IMPORTED_LOCATION" "${JEMALLOC_INSTALL_DIR}/lib/libjemalloc.a")</div><div>set_target_properties(libjemalloc-pic PROPERTIES</div><div>        "IMPORTED_LOCATION" "${JEMALLOC_INSTALL_DIR}/lib/libjemalloc-pic.a")</div><div><br></div><div># Make the targets depend on the external project download.</div><div>add_dependencies(libjemalloc Jemalloc)</div><div>add_dependencies(libjemalloc-pic Jemalloc)</div><div><br></div><div># Export the include directory path.</div><div>set(JEMALLOC_INCLUDE_DIR ${JEMALLOC_INSTALL_DIR}/include)</div></div><div><br></div><div>=================================<br></div><div><br></div><div><br></div><div>When I run this for the first time, the library code is pulled from Git and built. The second time around, I see this:</div><div><br></div><div><div>[ 13%] Performing update step for 'Jemalloc'</div><div>Current branch master is up to date.</div><div>[ 18%] Performing configure step for 'Jemalloc'</div><div>Configuring jemalloc</div><div>autoconf</div><div>./configure --enable-autogen </div></div><div><br></div><div>I really don't want anything to be rebuilt if there are no changes in the source repository. What am I doing wrong?</div><div><br></div><div><br></div></div>
</div><br></div>