Skip to content
Snippets Groups Projects
Commit a881fe86 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

STYLE: ELASTIX-1 Improve build system naming conventions

parent 7aa24c09
No related branches found
No related tags found
No related merge requests found
......@@ -9,4 +9,4 @@ set( CompilerFlags
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
)
)
\ No newline at end of file
# Visual Studio complains if paths are too long
string( LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" n )
if( n GREATER 50 )
message(
......
# GoogleTest needs static linking
include( ${CMAKE_SOURCE_DIR}/CMake/elxCompilerFlags.cmake )
include( elxCompilerFlags.cmake )
foreach( CompilerFlag ${CompilerFlags} )
string( REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}" )
endforeach()
cmake_minimum_required( VERSION 2.8 )
# Include SuperElastix CMake scripts
list( APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
)
if( CMAKE_HOST_WIN32 )
include( elxWinConfig.cmake )
endif()
......@@ -13,7 +18,7 @@ project( Elastix )
find_package( ITK REQUIRED )
set( ITK_NO_IO_FACTORY_REGISTER_MANAGER 1 )
include( ${ITK_USE_FILE} )
include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxRequiredITKModules.cmake" )
include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxITKRequiredModules.cmake" )
#---------------------------------------------------------------------
# Build Elastix
......@@ -21,14 +26,16 @@ include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxRequiredITKModules.cmake" )
#---------------------------------------------------------------------
# Testing
# Do not build tests by default since this requires GoogleTest submodule
# to be initialized. Otherwise users may see FATAL_ERRORs out of the box.
# The SuperBuild will correctly initialize the GoogleTest submodule and
# build tests by default.
option( ELASTIX_BUILD_TESTING "Enable building tests." OFF )
# Build tests by default
option( ELASTIX_BUILD_TESTING "Enable building tests." ON )
# ExternalData module requires newer CMake versions
if( CMAKE_VERSION VERSION_LESS 2.8.11 )
set( ELASTIX_BUILD_TESTING OFF FORCE )
message( STATUS "ELASTIX_BUILD_TESTING was set to OFF because CMake version is less than 2.8.11")
endif()
if( ELASTIX_BUILD_TESTING )
option( ELASTIX_BUILD_BENCHMARKING "Enable building benchmarks." OFF )
enable_testing()
add_subdirectory( Testing )
endif()
......@@ -40,5 +47,5 @@ mark_as_advanced( ELASTIX_BUILD_DOXYGEN )
option( ELASTIX_BUILD_DOXYGEN "Enable building Doxygen documentation." OFF )
mark_as_advanced( ELASTIX_BUILD_READTHEDOCS )
option( ELASTX_BUILD_READTHEDOCS "Enable building readthedocs.org documentation." OFF )
option( ELASTIX_BUILD_READTHEDOCS "Enable building readthedocs.org documentation." OFF )
cmake_minimum_required( VERSION 2.8 )
#---------------------------------------------------------------------
project( elastixSuperBuild )
project( ElastixSuperBuild )
find_package( Git REQUIRED )
......@@ -13,6 +13,8 @@ set( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "SuperBuild install directory" FORCE)
#---------------------------------------------------------------------
# Elastix SuperBuild configuration
......@@ -30,10 +32,11 @@ option( ELASTIX_BUILD_TESTING "Enable building tests." ON )
if( ELASTIX_BUILD_TESTING )
option( ELASTIX_BUILD_BENCHMARKING "Enable building benchmarks." ON )
option( ELASTIX_BUILD_DASHBOARD "Enable building benchmarks." ON )
endif()
#---------------------------------------------------------------------
# Build ITK as external project
# Build ITK
set( ITK_VERSION_MAJOR "4" )
set( ITK_VERSION_MINOR "7" )
......@@ -52,7 +55,7 @@ else()
endif()
#---------------------------------------------------------------------
# Build Elastix as an external project
# Build Elastix
include( Elastix )
......
......@@ -4,11 +4,11 @@ ExternalProject_Add( ${proj}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..
BINARY_DIR ${proj}-build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_ARGS
--no-warn-unused-cli
-DELASTIX_BUILD_TESTING:BOOL=${ELASTIX_BUILD_TESTING}
-DELASTIX_BUILD_BENCHMARKING:BOOL=${ELASTIX_BUILD_BENCHMARKING}
-DELASTIX_BUILD_DASHBOARD:BOOL=${ELASTIX_BUILD_DASHBOARD}
-DITK_DIR:PATH=${ITK_DIR}
DEPENDS ${ELASTIX_DEPENDENCIES}
INSTALL_COMMAND ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment