View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015914CMakeCMakepublic2016-01-12 16:292016-06-10 14:31
ReporterKim Topley 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformMacOSOS XOS Version11.2
Product VersionCMake 3.4 
Target VersionFixed in Version 
Summary0015914: Update and subsequent steps of ExternalProject_Add are executed even when there is no change in the downloaded source
DescriptionI have several CMake files that download and build source from a Git repo or a file on SourceForge, using ExternalProject_Add. Everything works, except that the software is rebuilt every time I run make, even if nothing new was pulled from Git or the downloaded source file did not change. This means that builds that should take a couple of seconds take many minutes.
Steps To ReproduceI use a file that imports the following snippet:

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)
Additional InformationThe issue seems to be that the -update target in the generated Makefile is always seen to be out of date. It looks like that's because it doesn't do a touch at the end, unlike all of the other similar targets. I added a touch to the generated file and it stopped rebuilding the source:

Jemalloc/src/Jemalloc-stamp/Jemalloc-update: Jemalloc/src/Jemalloc-stamp/Jemalloc-download
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/Users/kim/clionprojects/Hacking2/XYZZY/CMakeFiles --progress-num=$(CMAKE_PROGRESS_5) "Performing update step for 'Jemalloc'"
    cd /Users/kim/clionprojects/Hacking2/XYZZY/Jemalloc/src/Jemalloc && /Applications/CMake.app/Contents/bin/cmake -P /Users/kim/clionprojects/Hacking2/XYZZY/Jemalloc/tmp/Jemalloc-gitupdate.cmake
    echo I ADDED THE NEXT LINE.....
    cd /Users/kim/clionprojects/Hacking2/XYZZY/Jemalloc/src && /Applications/CMake.app/Contents/bin/cmake -E touch /Users/kim/clionprojects/Hacking2/XYZZY/Jemalloc/src/Jemalloc-stamp/Jemalloc-update
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0042911)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-01-12 16:29 Kim Topley New Issue
2016-06-10 14:29 Kitware Robot Note Added: 0042911
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team