Commit 053a11ea authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: Install CMake config files

parent 5af0e723
......@@ -58,9 +58,9 @@ macro( _selxmodules_initialize )
option( USE_${MODULE} OFF )
set( ${MODULE}_IS_ENABLED FALSE )
set( ${MODULE}_CMAKE_FILE ${CMAKE_SOURCE_DIR}/${${MODULE}_PATH}/${MODULE}.cmake )
set( ${MODULE}_SOURCE_DIR ${CMAKE_SOURCE_DIR}/${${MODULE}_PATH} )
set( ${MODULE}_BINARY_DIR ${CMAKE_BINARY_DIR}/${${MODULE}_PATH} )
set( ${MODULE}_CMAKE_FILE ${PROJECT_SOURCE_DIR}/${${MODULE}_PATH}/${MODULE}.cmake )
set( ${MODULE}_SOURCE_DIR ${PROJECT_SOURCE_DIR}/${${MODULE}_PATH} )
set( ${MODULE}_BINARY_DIR ${PROJECT_BINARY_DIR}/${${MODULE}_PATH} )
# Collect header files for Visual Studio
# http://stackoverflow.com/questions/8316104/specify-how-cmake-creates-visual-studio-project
......@@ -71,7 +71,6 @@ macro( _selxmodules_initialize )
set( ${MODULE}_SOURCE_FILES )
set( ${MODULE}_TEST_SOURCE_FILES )
set( ${MODULE}_MODULE_DEPENDENCIES )
set( ${MODULE}_LIBRARY_DIRS )
set( ${MODULE}_LIBRARIES )
list( APPEND SUPERELASTIX_MODULES ${MODULE} )
......
......@@ -19,13 +19,14 @@
cmake_minimum_required( VERSION 3.0.2 )
# Explicitly add INCREMENTAL linking option to command lines.
# http://www.cmake.org/pipermail/cmake/2010-February/035174.html
#set( MSVC_INCREMENTAL_DEFAULT ON )
# ---------------------------------------------------------------------
project( SuperElastix )
set( SUPERELATIX_MAJOR_VERSION 0)
set( SUPERELATIX_MINOR_VERSION 1)
set( SUPERELATIX_PATCH_VERSION 0)
set( SUPERELATIX_VERSION ${SUPERELATIX_MAJOR_VERSION}.${SUPERELATIX_MINOR_VERSION}.${SUPERELATIX_PATCH_VERSION})
# Place executables in the bin directory
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" )
......@@ -82,7 +83,7 @@ if( ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC )
# set( MSVC_INCREMENTAL_DEFAULT ON )
endif()
if( NOT CMAKE_BUILD_TYPE)
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE )
......@@ -107,13 +108,12 @@ endforeach()
# ---------------------------------------------------------------------
# Boost Library
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
#set( Boost_DEBUG ON )
set(BOOST_INCLUDEDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/boost/" )
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/stage/lib/" )
set(BOOST_ROOT "${BOOST_ROOT}/BOOST-prefix/src/Boost/" )
set( Boost_USE_STATIC_LIBS ON ) # only find static libs
set( Boost_USE_MULTITHREADED ON )
set( Boost_USE_STATIC_RUNTIME OFF )
set( BOOST_INCLUDEDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/boost/" )
set( BOOST_LIBRARYDIR "${BOOST_ROOT}/BOOST-prefix/src/Boost/stage/lib/" )
set( BOOST_ROOT "${BOOST_ROOT}/BOOST-prefix/src/Boost/" )
find_package( Boost COMPONENTS filesystem system log date_time thread regex REQUIRED QUIET ) # graph ?
include_directories( ${Boost_INCLUDE_DIRS} )
......@@ -150,10 +150,10 @@ endif()
# ---------------------------------------------------------------------
# Testing
set( SUPERELASTIX_INPUT_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing/Data/Input )
set( SUPERELASTIX_OUTPUT_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing/Data/Output )
set( SUPERELASTIX_BASELINE_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing/Data/Baseline )
set( SUPERELASTIX_CONFIGURATION_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Testing/Data/Configuration )
set( SUPERELASTIX_INPUT_DATA_DIR ${PROJECT_BINARY_DIR}/Testing/Data/Input )
set( SUPERELASTIX_OUTPUT_DATA_DIR ${PROJECT_BINARY_DIR}/Testing/Data/Output )
set( SUPERELASTIX_BASELINE_DATA_DIR ${PROJECT_BINARY_DIR}/Testing/Data/Baseline )
set( SUPERELASTIX_CONFIGURATION_DATA_DIR ${PROJECT_BINARY_DIR}/Testing/Data/Configuration )
if( NOT EXISTS ${SUPERELASTIX_OUTPUT_DATA_DIR} )
file( MAKE_DIRECTORY ${SUPERELASTIX_OUTPUT_DATA_DIR} )
......@@ -198,15 +198,50 @@ configure_file( UseSuperElastix.cmake.in UseSuperElastix.cmake COPYONLY IMMEDIAT
# ---------------------------------------------------------------------
# Installation
set( CMAKE_INSTALL_DIR "" )
if( WIN32 AND NOT CYGWIN )
set( CMAKE_INSTALL_DIR CMake )
else()
set( CMAKE_INSTALL_DIR lib/CMake/SuperElastix )
endif()
# Add all targets to the build-tree export set
export( TARGETS ModuleFilter FILE "${PROJECT_BINARY_DIR}/SuperElastixTargets.cmake" )
# Register the build-tree with a global CMake-registry
export( PACKAGE SuperElastix )
# Create the SuperElastix.cmake files
# ... for the build tree
set( SUPERELASTIX_CONF_INCLUDE_DIRS ${SUPERELASTIX_INCLUDE_DIRS} )
set( SUPERELASTIX_CONF_LIBRARY_DIRS ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
set( SUPERELASTIX_CONF_LIBRARIES ${SUPERELASTIX_LIBRARIES} )
configure_file( SuperElastixConfig.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfig.cmake" @ONLY)
# ... for the install tree
set( SUPERELASTIX_CONF_INCLUDE_DIRS include )
set( SUPERELASTIX_CONF_LIBRARY_DIRS lib )
set( SUPERELASTIX_CONF_LIBRARIES "ModuleFilter" )
configure_file( SuperElastixConfig.cmake.in "${PROJECT_BINARY_DIR}/install/SuperElastixConfig.cmake" @ONLY)
# Create the SuperElastixVersion.cmake file
configure_file( SuperElastixConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake" @ONLY)
# Install the SuperElastix.cmake and SuperElastixConfigVersion.cmake
install( FILES
"${PROJECT_BINARY_DIR}/install/SuperElastixConfig.cmake"
"${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_DIR}" )
install( FILES
Modules/Filter/include/selxSuperElastixFilter.h
Modules/Filter/include/selxSuperElastixFilterCustomComponents.h
Modules/Filter/include/itkUniquePointerDataObjectDecorator.h
Modules/Blueprints/include/selxBlueprint.h
Modules/Logger/include/selxLogger.h
Modules/FileIO/include/selxAnyFileReader.h
Modules/FileIO/include/selxAnyFileWriter.h
DESTINATION include )
install( TARGETS ModuleFilter
DESTINATION lib )
INSTALL( FILES Modules/Filter/include/selxSuperElastixFilter.h
Modules/Filter/include/selxSuperElastixFilterCustomComponents.h
Modules/Filter/include/itkUniquePointerDataObjectDecorator.h
Modules/Blueprints/include/selxBlueprint.h
Modules/Logger/include/selxLogger.h
Modules/FileIO/include/selxAnyFileReader.h
Modules/FileIO/include/selxAnyFileWriter.h
DESTINATION include )
\ No newline at end of file
......@@ -25,7 +25,7 @@ ExternalProject_Add( ${proj}
BINARY_DIR ${proj}-build
CMAKE_ARGS
--no-warn-unused-cli
-CMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DBUILD_EXAMPLES:BOOL=${BUILD_EXAMPLES}
-DBUILD_TESTING:BOOL=${BUILD_TESTING}
......
get_filename_component( SUPERELASTIX_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH )
# Add include directories needed to use SuperElastix
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_INCLUDE_DIRS@ )
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_CONF_INCLUDE_DIRS@ )
# Add link directories needed to use SuperElastix
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_BINARY_DIR@ )
# Add include directories needed to use libraries
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_CONF_LIBRARY_DIRS@ )
# Add list of SuperElastix libraries
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_LIBRARIES@ )
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_CONF_LIBRARIES@ )
# The location of the SuperElastix use-file
set( SUPERELASTIX_USE_FILE "@SUPERELASTIX_CONFIG_DIR@/UseSuperElastix.cmake")
set( SUPERELASTIX_USE_FILE "${SUPERELASTIX_DIR}/UseSuperElastix.cmake")
set( PACKAGE_VERSION "@SUPERELASTIX_VERSION@" )
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if( "${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set( PACKAGE_VERSION_COMPATIBLE FALSE )
else()
set( PACKAGE_VERSION_COMPATIBLE TRUE )
if ( "${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}" )
set( PACKAGE_VERSION_EXACT TRUE )
endif()
endif()
......@@ -2,7 +2,7 @@
# This file sets up include directories and link directories
# for a project to use SuperElastix. It should not be
# included directly, but rather through the SUPERELASTIX_USE_FILE setting
# obtained from SimpleITKConfig.cmake.
# obtained from SuperElastixConfig.cmake.
#
# Add include directories needed to use SuperElastix
......
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