Commit f53a49ab authored by jcfr's avatar jcfr
Browse files

COMP: Remove 'Slicer3PersistenceMacros' and use CMake native function

Calling SET with the FORCE option provide the same functionality

git-svn-id: http://svn.slicer.org/Slicer4/trunk@16168 3bd1e089-480b-0410-8dfb-8563597acbee
parent efbe085e
......@@ -43,8 +43,8 @@ SET(include_dirs
INCLUDE_DIRECTORIES(${include_dirs})
slicer3_get_persistent_property(Slicer_Base_INCLUDE_DIRS tmp)
slicer3_set_persistent_property(Slicer_Base_INCLUDE_DIRS ${tmp} ${include_dirs})
# Update Slicer_Base_INCLUDE_DIRS
SET(Slicer_Base_INCLUDE_DIRS ${Slicer_Base_INCLUDE_DIRS} ${include_dirs} CACHE INTERNAL "Slicer Base includes" FORCE)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/vtkSlicerBaseCLIConfigure.h.in
......@@ -84,8 +84,8 @@ TARGET_LINK_LIBRARIES(${lib_name}
)
SET_TARGET_PROPERTIES(${lib_name} PROPERTIES LABELS ${lib_name})
slicer3_get_persistent_property(Slicer_Base_LIBRARIES tmp)
slicer3_set_persistent_property(Slicer_Base_LIBRARIES ${tmp} SlicerBaseCLI)
# Update Slicer_Base_LIBRARIES
SET(Slicer_Base_LIBRARIES ${Slicer_Base_LIBRARIES} ${lib_name} CACHE INTERNAL "Slicer Base libraries" FORCE)
# Apply user-defined properties to the library target.
IF(Slicer_LIBRARY_PROPERTIES)
......
......@@ -62,8 +62,8 @@ ENDIF()
include_directories(${include_dirs})
slicer3_get_persistent_property(Slicer_Base_INCLUDE_DIRS tmp)
slicer3_set_persistent_property(Slicer_Base_INCLUDE_DIRS ${tmp} ${include_dirs})
# Update Slicer_Base_INCLUDE_DIRS
SET(Slicer_Base_INCLUDE_DIRS ${Slicer_Base_INCLUDE_DIRS} ${include_dirs} CACHE INTERNAL "Slicer Base includes" FORCE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkSlicerBaseLogicConfigure.h.in
......@@ -170,8 +170,8 @@ ENDIF()
TARGET_LINK_LIBRARIES(${lib_name} ${libs})
SET_TARGET_PROPERTIES(${lib_name} PROPERTIES LABELS ${lib_name})
slicer3_get_persistent_property(Slicer_Base_LIBRARIES tmp)
slicer3_set_persistent_property(Slicer_Base_LIBRARIES ${tmp} ${lib_name})
# Update Slicer_Base_LIBRARIES
SET(Slicer_Base_LIBRARIES ${Slicer_Base_LIBRARIES} ${lib_name} CACHE INTERNAL "Slicer Base libraries" FORCE)
# Apply user-defined properties to the library target.
IF(Slicer_LIBRARY_PROPERTIES)
......
#-----------------------------------------------------------------------------
# Temporary hack to set/get persistent values accross subdirs until 2.6 comes
# Neither set_source_file_properties nor set(... INTERNAL FORCE) would work
#-----------------------------------------------------------------------------
macro(slicer3_set_persistent_property property_name)
set(_file "${CMAKE_BINARY_DIR}/persistent/${property_name}")
file(WRITE "${_file}" "${ARGN}")
#set(__${property_name} ${value} CACHE INTERNAL "" FORCE)
endmacro(slicer3_set_persistent_property property_name value)
#-----------------------------------------------------------------------------
macro(slicer3_get_persistent_property property_name var_name)
set(_file "${CMAKE_BINARY_DIR}/persistent/${property_name}")
if(EXISTS "${_file}")
file(READ "${_file}" ${var_name})
else(EXISTS "${_file}")
set(${var_name})
endif(EXISTS "${_file}")
#set(${var_name} ${__${property_name}})
endmacro(slicer3_get_persistent_property property_name var_name)
......@@ -97,8 +97,8 @@ MACRO(SlicerMacroBuildBaseQtLibrary)
INCLUDE_DIRECTORIES(${include_dirs})
slicer3_get_persistent_property(Slicer_Base_INCLUDE_DIRS tmp)
slicer3_set_persistent_property(Slicer_Base_INCLUDE_DIRS ${tmp} ${include_dirs})
# Update Slicer_Base_INCLUDE_DIRS
SET(Slicer_Base_INCLUDE_DIRS ${Slicer_Base_INCLUDE_DIRS} ${include_dirs} CACHE INTERNAL "Slicer Base includes" FORCE)
#-----------------------------------------------------------------------------
# Configure
......@@ -149,8 +149,8 @@ MACRO(SlicerMacroBuildBaseQtLibrary)
# --------------------------------------------------------------------------
# Build the library
slicer3_get_persistent_property(Slicer_Base_LIBRARIES tmp)
slicer3_set_persistent_property(Slicer_Base_LIBRARIES ${tmp} ${lib_name})
# Update Slicer_Base_LIBRARIES
SET(Slicer_Base_LIBRARIES ${Slicer_Base_LIBRARIES} ${lib_name} CACHE INTERNAL "Slicer Base libraries" FORCE)
ADD_LIBRARY(${lib_name}
${SLICERQTBASELIB_SRCS}
......
......@@ -41,7 +41,6 @@ SET(Slicer_LOGOS_RESOURCE "${Slicer_SOURCE_DIR}/Resources/qSlicerLogos.qrc")
# CMake Function(s) and Macro(s)
#-----------------------------------------------------------------------------
INCLUDE(CMake/Slicer3PersistenceMacros.cmake)
INCLUDE(CMake/Slicer3PluginsMacros.cmake)
INCLUDE(CMake/SlicerMacroParseArguments.cmake)
INCLUDE(CMake/SlicerMacroBuildCLI.cmake)
......@@ -353,15 +352,16 @@ ENDIF()
#-----------------------------------------------------------------------------
# Slicer include and libraries subdirectory
#
slicer3_set_persistent_property(Slicer_Libs_LIBRARIES "")
slicer3_set_persistent_property(Slicer_Base_LIBRARIES "")
slicer3_set_persistent_property(Slicer_Modules_LIBRARIES "")
slicer3_set_persistent_property(Slicer_QTModules_LIBRARIES "")
slicer3_set_persistent_property(Slicer_Libs_INCLUDE_DIRS "")
slicer3_set_persistent_property(Slicer_Base_INCLUDE_DIRS "")
slicer3_set_persistent_property(Slicer_Modules_INCLUDE_DIRS "")
slicer3_set_persistent_property(Slicer_QTModules_INCLUDE_DIRS "")
SET(Slicer_Libs_LIBRARIES CACHE INTERNAL "Slicer Libs libraries" FORCE)
SET(Slicer_Base_LIBRARIES CACHE INTERNAL "Slicer Base libraries" FORCE)
SET(Slicer_Modules_LIBRARIES CACHE INTERNAL "Slicer Modules libraries" FORCE)
SET(Slicer_QTModules_LIBRARIES CACHE INTERNAL "Slicer QTModules libraries" FORCE)
SET(Slicer_Libs_INCLUDE_DIRS CACHE INTERNAL "Slicer Libs includes" FORCE)
SET(Slicer_Base_INCLUDE_DIRS CACHE INTERNAL "Slicer Base includes" FORCE)
SET(Slicer_Modules_INCLUDE_DIRS CACHE INTERNAL "Slicer Modules includes" FORCE)
SET(Slicer_QTModules_INCLUDE_DIRS CACHE INTERNAL "Slicer QTModules includes" FORCE)
#-----------------------------------------------------------------------------
# Get sytem name and architecture
......@@ -688,23 +688,6 @@ ADD_SUBDIRECTORY(Libs)
ADD_SUBDIRECTORY(Base)
ADD_SUBDIRECTORY(Resources)
#-----------------------------------------------------------------------------
# At this point, let's not have the applications and modules guess which
# include paths or libraries they need, but use Slicer3_*_LIBRARIES and
# Slicer_*_INCLUDE_DIRS instead. As far as modules are concerned, both
# variables are actually set automatically by the import script when building
# against a Slicer build or installed tree. When in-source, we need to
# set both variables now. Retrieve them from the persistent property cache
# since they were collected in each subdir (which makes it impossible to
# use normal variables, since a new scope is created in each subdir).
#
slicer3_get_persistent_property(Slicer_Libs_LIBRARIES Slicer_Libs_LIBRARIES)
slicer3_get_persistent_property(Slicer_Base_LIBRARIES Slicer_Base_LIBRARIES)
slicer3_get_persistent_property(Slicer_Libs_INCLUDE_DIRS Slicer_Libs_INCLUDE_DIRS)
slicer3_get_persistent_property(Slicer_Base_INCLUDE_DIRS Slicer_Base_INCLUDE_DIRS)
#-----------------------------------------------------------------------------
# Module Logic
#-----------------------------------------------------------------------------
......
......@@ -102,11 +102,8 @@ LIST(REMOVE_ITEM libs SlicerExecutionModel) # Not a library
# Update variable Slicer_Libs_LIBRARIES and Slicer_Libs_INCLUDE_DIRS
#-----------------------------------------------------------------------------
slicer3_get_persistent_property(Slicer_Libs_LIBRARIES tmp)
slicer3_set_persistent_property(Slicer_Libs_LIBRARIES ${tmp} ${libs})
slicer3_get_persistent_property(Slicer_Libs_INCLUDE_DIRS tmp)
slicer3_set_persistent_property(Slicer_Libs_INCLUDE_DIRS ${tmp} ${include_dirs})
SET(Slicer_Libs_LIBRARIES ${Slicer_Libs_LIBRARIES} ${libs} CACHE INTERNAL "Slicer Libs libraries" FORCE)
SET(Slicer_Libs_INCLUDE_DIRS ${Slicer_Libs_INCLUDE_DIRS} ${include_dirs} CACHE INTERNAL "Slicer Libs includes" FORCE)
#-----------------------------------------------------------------------------
# Loop over list of directories
......
......@@ -78,7 +78,6 @@ endif(NOT WIN32)
# Add cmake module path.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Slicer_CMAKE_DIR}")
include(Slicer3Macros)
include(Slicer3PersistenceMacros)
include(Slicer3ModulesMacros)
include(Slicer3PluginsMacros)
include(SlicerMacroParseArguments)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment