From a534a6dee6fa538a397067cef6e7044a9dad34f1 Mon Sep 17 00:00:00 2001 From: jcfr Date: Tue, 26 Apr 2011 08:28:39 +0000 Subject: [PATCH] COMP: Added Utilites/LastConfigureStep The commands in this directory are intended to be executed as the end of the whole configuration process, as a "last step". This directory is typically the last add_subdirectory in the main CMakeLists.txt. git-svn-id: http://svn.slicer.org/Slicer4/trunk@16351 3bd1e089-480b-0410-8dfb-8563597acbee --- CMakeLists.txt | 43 ++++++++++++---------- Utilities/LastConfigureStep/CMakeLists.txt | 39 ++++++++++++++++++++ 2 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 Utilities/LastConfigureStep/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index ceafb3e28..2fd6f1617 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -605,12 +605,15 @@ SET(CMAKE_C_FLAGS ${Slicer_C_FLAGS} CACHE STRING "CMake CXX Flags" FORCE) SET(Slicer_WC_URL NA) SET(Slicer_WC_REVISION 0) +SET(slicer_version_file_source ${CMAKE_CURRENT_SOURCE_DIR}/SlicerVersion.txt.in) +SET(slicer_version_file_binary ${Slicer_HOME}/lib/Slicer3/SlicerVersion.txt) + # Case where Slicer is checkout using SVN IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn) Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} Slicer) CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/SlicerVersion.txt.in - ${Slicer_HOME}/lib/Slicer3/SlicerVersion.txt + ${slicer_version_file_source} + ${slicer_version_file_binary} ) ENDIF() @@ -618,11 +621,17 @@ ENDIF() IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/svn/refs/remotes) GIT_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} Slicer) CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/SlicerVersion.txt.in - ${Slicer_HOME}/lib/Slicer3/SlicerVersion.txt + ${slicer_version_file_source} + ${slicer_version_file_binary} ) ENDIF() +INSTALL(FILES + ${slicer_version_file_binary} + DESTINATION ${Slicer_INSTALL_LIB_DIR} + COMPONENT Development + ) + #----------------------------------------------------------------------------- # Includes @@ -754,19 +763,15 @@ ADD_SUBDIRECTORY(Utilities/Doxygen) # Add CMake directory so that install rules associated with *.cmake files are evaluated ADD_SUBDIRECTORY(CMake) -#----------------------------------------------------------------------------- -# Set up for building against a Slicer build tree and a Slicer installation -#----------------------------------------------------------------------------- -INCLUDE(${Slicer_SOURCE_DIR}/GenerateSlicerConfig.cmake) - -CONFIGURE_FILE(${Slicer_SOURCE_DIR}/UseSlicer.cmake.in - ${Slicer_BINARY_DIR}/UseSlicer.cmake COPYONLY IMMEDIATE) +#INSTALL(FILES +# ${Slicer_BINARY_DIR}/UseSlicer.cmake +# ${Slicer_BINARY_DIR}/Utilities/SlicerConfig.cmake +# DESTINATION ${Slicer_INSTALL_LIB_DIR} +# COMPONENT Development +# ) -INSTALL(FILES - # ${Slicer_BINARY_DIR}/Slicer3BuildSettings.cmake - ${Slicer_BINARY_DIR}/UseSlicer.cmake - ${Slicer_BINARY_DIR}/Utilities/SlicerConfig.cmake - ${Slicer_BINARY_DIR}/lib/Slicer3/SlicerVersion.txt - DESTINATION ${Slicer_INSTALL_LIB_DIR} - COMPONENT Development - ) +#----------------------------------------------------------------------------- +# The commands in this directory are intended to be executed as +# the end of the whole configuration process, as a "last step". +# This directory is typically the last add_subdirectory in the main CMakeLists.txt. +ADD_SUBDIRECTORY(Utilities/LastConfigureStep) diff --git a/Utilities/LastConfigureStep/CMakeLists.txt b/Utilities/LastConfigureStep/CMakeLists.txt new file mode 100644 index 000000000..c8dee3151 --- /dev/null +++ b/Utilities/LastConfigureStep/CMakeLists.txt @@ -0,0 +1,39 @@ +################################################################################ +# +# Program: 3D Slicer +# +# Copyright (c) 2010 Kitware Inc. +# +# See Doc/copyright/copyright.txt +# or http://www.slicer.org/copyright/copyright.txt for details. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc. +# and was partially funded by NIH grant 3P41RR013218-12S1 +# +################################################################################ + +# The commands in this directory are intended to be executed as +# the end of the whole configuration process, as a "last step". +# This directory is typically the last SUBDIRS in the main CMakeLists.txt. +# It enable the above commands to use variables that might have been configured +# in previous SUBDIRS. This is especially important when it comes to +# the CONFIGURE_FILE command, since in IMMEDIATE mode that command will +# use the current values of CMake variables instead of waiting until the +# end of CMakeLists processing, i.e. instead of waiting until some variables +# are configured in SUBDIRS. + +CONFIGURE_FILE( + ${Slicer_SOURCE_DIR}/UseSlicer.cmake.in + ${Slicer_BINARY_DIR}/UseSlicer.cmake COPYONLY) + +#----------------------------------------------------------------------------- +# Create the SlicerConfig.cmake file containing the Slicer configuration. +# Since it might generate configuration file depending +INCLUDE(${Slicer_SOURCE_DIR}/GenerateSlicerConfig.cmake) + -- 2.22.0