Commit f82a0343 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: Build Applications as an external project using find_package(...

ENH: Build Applications as an external project using find_package( SuperElastixSuperBuild ) and find_package( SuperElastix )
parent 13335150
......@@ -56,4 +56,6 @@ include( ${SUPERELASTIX_USE_FILE} )
find_package( ITK )
include( ${ITK_USE_FILE} )
include( ${ELASTIX_USE_FILE} )
add_subdirectory( CommandLineInterface )
......@@ -195,12 +195,6 @@ option( BUILD_DOXYGEN "Enable building Doxygen documentation." OFF )
mark_as_advanced( BUILD_READTHEDOCS )
option( BUILD_READTHEDOCS "Enable building readthedocs.org documentation." OFF )
# ---------------------------------------------------------------------
# Enable other projects to use SuperElastix via CMake's find_packge() and a use-file
# set( SUPERELASTIX_CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR} )
# set( SUPERELASTIX_BINARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} )
# ---------------------------------------------------------------------
# Installation
......@@ -216,10 +210,13 @@ export( PACKAGE SuperElastix )
# Create the SuperElastix.cmake files
# ... for the build tree
set( SUPERELASTIX_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastix.cmake" )
set( SUPERELASTIX_INSTALL_INCLUDE_DIRS ${SUPERELASTIX_INCLUDE_DIRS} )
set( SUPERELASTIX_INSTALL_LIBRARY_DIRS ${SUPERELASTIX_LIBRARY_DIRS} )
set( SUPERELASTIX_INSTALL_LIBRARIES ${SUPERELASTIX_LIBRARIES} )
set( SUPERELASTIX_INSTALL_USE_FILE "${PROJECT_BINARY_DIR}/UseSuperElastix.cmake" )
configure_file( SuperElastixConfig.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfig.cmake" @ONLY)
configure_file( SuperElastixConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixConfigVersion.cmake" @ONLY)
configure_file( UseSuperElastix.cmake.in "${SUPERELASTIX_USE_FILE}" @ONLY )
configure_file( UseSuperElastix.cmake.in "${SUPERELASTIX_INSTALL_USE_FILE}" @ONLY )
# ... for the install tree
install(CODE "set( SUPERELASTIX_INSTALL_INCLUDE_DIRS include )" )
......@@ -241,5 +238,5 @@ install( FILES
Modules/FileIO/include/selxAnyFileWriter.h
DESTINATION include )
install( TARGETS ModuleFilter ModuleBlueprints ModuleLogger
install( TARGETS ModuleFilter ModuleBlueprints ModuleLogger ModuleComponentInterface
DESTINATION lib )
......@@ -134,6 +134,9 @@ endif()
# ---------------------------------------------------------------------
# Installation
# Register the build-tree with a global CMake-registry
export( PACKAGE SuperElastixSuperBuild )
set( CMAKE_INSTALL_DIR "" )
if( WIN32 AND NOT CYGWIN )
set( CMAKE_INSTALL_DIR CMake )
......@@ -146,8 +149,6 @@ configure_file( SuperElastixSuperBuildConfig.cmake.in "${PROJECT_BINARY_DIR}/Sup
configure_file( SuperElastixSuperBuildConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SuperElastixSuperBuildConfigVersion.cmake" @ONLY)
configure_file( UseSuperElastixSuperBuild.cmake.in "${SUPERELASTIXSUPERBUILD_USE_FILE}" @ONLY )
# TODO: Install to system
# ---------------------------------------------------------------------
# Build SuperElastix
......
......@@ -36,7 +36,7 @@ ExternalProject_Add( ${proj}
INSTALL_COMMAND ""
)
ExternalProject_Get_Property( SuperElastix binary_dir )
ExternalProject_Get_Property( ${proj} binary_dir )
set( SuperElastix_DIR "${binary_dir}" )
list( APPEND SUPERELASTIX_DEPENDENCIES ${proj} )
......@@ -6,7 +6,7 @@ if( NOT USE_SYSTEM_BOOST )
set( BOOST_ROOT @BOOST_ROOT@ )
endif()
if( NOT USE_SYSTEM_GTEST)
if( NOT USE_SYSTEM_GTEST )
set( GTEST_ROOT @GTEST_ROOT@ )
endif()
......
set( SUPERELASTIX_DIR @PROJECT_BINARY_DIR@ )
# Add include directories needed to use SuperElastix
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_INCLUDE_DIRS@ )
set( SUPERELASTIX_INCLUDE_DIRS @SUPERELASTIX_INSTALL_INCLUDE_DIRS@ )
# Add list of SuperElastix library directories
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_LIBRARY_DIRS@ )
set( SUPERELASTIX_LIBRARY_DIRS @SUPERELASTIX_INSTALL_LIBRARY_DIRS@ )
# Add list of SuperElastix libraries
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_LIBRARIES@ )
set( SUPERELASTIX_LIBRARIES @SUPERELASTIX_INSTALL_LIBRARIES@ )
# The location of the SuperElastix use-file
set( SUPERELASTIX_USE_FILE @SUPERELASTIX_USE_FILE@)
set( SUPERELASTIX_USE_FILE @SUPERELASTIX_INSTALL_USE_FILE@ )
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