Skip to content

Commit

Permalink
COMP: Avoid continuous rebuild of ExternalPackages
Browse files Browse the repository at this point in the history
New option added to that defaults to off for FORCE_EXTERNAL_BUILDS.
This needs to be turned ON to allow updating of external packages.

Needed to split the ExternalProject command and argument into separate
varables for their effect to work.  Otherwise they were having no
noticiable effect on the build system.
  • Loading branch information
hjmjohnson committed Feb 7, 2013
1 parent 4954ae8 commit 6970682
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 12 deletions.
27 changes: 22 additions & 5 deletions SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/Common.cmake)
#-----------------------------------------------------------------------------
# Git protocol option
#-----------------------------------------------------------------------------
option(${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL "For development, turn this on to use the git protocol instead." OFF)
set(git_protocol "http")
if( ${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL)
set(git_protocol "git")
option(${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL "If behind a firewall turn this off to use http instead." ON)
set(git_protocol "git")
if(NOT ${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL)
set(git_protocol "http")
endif()

find_package(Git REQUIRED)
Expand All @@ -45,6 +45,19 @@ else()
set(gen "${CMAKE_GENERATOR}")
endif()


# With CMake 2.8.9 or later, the UPDATE_COMMAND is required for updates to occur.
# For earlier versions, we nullify the update state to prevent updates and
# undesirable rebuild.
option(FORCE_EXTERNAL_BUILDS "Force rebuilding of external project (if they are updated)" OFF)
if(CMAKE_VERSION VERSION_LESS 2.8.9 OR NOT FORCE_EXTERNAL_BUILDS)
set(cmakeversion_external_update UPDATE_COMMAND)
set(cmakeversion_external_update_value "" )
else()
set(cmakeversion_external_update LOG_UPDATE )
set(cmakeversion_external_update_value 1)
endif()

#-----------------------------------------------------------------------------
# Platform check
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -80,6 +93,8 @@ CMAKE_DEPENDENT_OPTION(
"BUILD_STYLE_UTILS" OFF
)

set(EXTERNAL_PROJECT_BUILD_TYPE "Release" CACHE STRING "Default build type for support libraries")

option(USE_SYSTEM_ITK "Build using an externally defined version of ITK" OFF)
option(USE_SYSTEM_SlicerExecutionModel "Build using an externally defined version of SlicerExecutionModel" OFF)

Expand Down Expand Up @@ -179,7 +194,9 @@ list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS

_expand_external_project_vars()
set(COMMON_EXTERNAL_PROJECT_ARGS ${${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_ARGS})
SlicerMacroCheckExternalProjectDependency(${LOCAL_PROJECT_NAME})
set(extProjName ${LOCAL_PROJECT_NAME})
set(proj ${LOCAL_PROJECT_NAME})
SlicerMacroCheckExternalProjectDependency(${proj})

#-----------------------------------------------------------------------------
# Set CMake OSX variable to pass down the external project
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ExternalProject_add(Boost
# URL http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz
# URL_MD5 e0defc8c818e4f1c5bbb29d0292b76ca
SOURCE_DIR Boost
"${cmakeversion_external_update}"
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DBUILD_DIR:PATH=${CMAKE_CURRENT_BINARY_DIR}/Boost
-DBOOST_INSTALL_DIR:PATH=${Boost_Install_Dir}
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_Cppcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(NOT DEFINED Cppcheck_EXE AND NOT ${USE_SYSTEM_Cppcheck})
GIT_TAG ${Cppcheck_GIT_TAG}
SOURCE_DIR ${proj}
BUILD_IN_SOURCE 1
${cmakeversion_external_update}
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CONFIGURE_COMMAND ""
BUILD_COMMAND HAVE_RULES=no ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND HAVE_RULES=no DESTDIR=${CMAKE_BINARY_DIR}/ PREFIX=Utils ${CMAKE_MAKE_PROGRAM} install
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_ITKv4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}})
GIT_TAG ${${proj}_GIT_TAG}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
"${cmakeversion_external_update}"
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
-Wno-dev
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_KWStyle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(NOT DEFINED KWStyle_EXE AND NOT ${USE_SYSTEM_KWStyle})
CVS_MODULE KWStyle
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
${cmakeversion_external_update}
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_ARGS
${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/Utils
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_SlicerExecutionModel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}})
GIT_TAG ${${proj}_GIT_TAG}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
${cmakeversion_external_update}
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_Uncrustify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(NOT DEFINED Uncrustify_EXE AND NOT ${USE_SYSTEM_Uncrustify})
ExternalProject_add(${proj}
GIT_REPOSITORY ${Uncrustify_REPOSITORY}
GIT_TAG ${Uncrustify_GIT_TAG}
${cmakeversion_external_update}
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${CMAKE_BINARY_DIR}/Utils
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_VTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}})
GIT_TAG ${${proj}_GIT_TAG}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
${cmakeversion_external_update}
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
Expand Down

0 comments on commit 6970682

Please sign in to comment.