From 607bb248c4137758cf6a378d1cd5fc4408b1b40c Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 14 Feb 2018 17:04:04 +0100 Subject: [PATCH 1/8] COMP: Set cmake_minimum_required to 3.5.1, removed old policies, to fix #21 Note: it should still be seen if this commit does not break anything: * https://travis-ci.org/SuperElastix/elastix should support the new CMake version requirement * CMP0007, the new way empty list items are supported should be OK with elastix. * CMP0033: The removal of export_library_dependencies should be OK with elastix. cmake_minimum_required is chosen to be in sync with SuperElastix. --- CMakeLists.txt | 15 +++++---------- dox/externalproject/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bba09a7c..0db6a877b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,9 @@ -cmake_minimum_required( VERSION 2.8 ) +cmake_minimum_required( VERSION 3.5.1 ) project( elastix ) #--------------------------------------------------------------------- cmake_policy( SET CMP0012 NEW ) -if( POLICY CMP0033 ) - # This policy was introduced in cmake 3, so we need to check for its - # existence. When the minimum cmake version above is upgraded to 3 - # this if(POLICY) check can be removed. - cmake_policy( SET CMP0033 OLD ) -endif() - -cmake_policy( SET CMP0007 OLD ) cmake_policy( SET CMP0042 NEW ) #--------------------------------------------------------------------- @@ -551,7 +543,10 @@ endif() # Save library dependencies. # The library dependencies file. set( elxLIBRARY_DEPENDS_FILE ${elastix_BINARY_DIR}/elxLibraryDepends.cmake ) -export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) +# TODO Replace the original command, +# export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) +# by export() and install(EXPORT) commands +# See https://cmake.org/cmake/help/v3.10/policy/CMP0033.html # The build settings file. (necessary for elastix?) #set( ITK_BUILD_SETTINGS_FILE ${ITK_BINARY_DIR}/ITKBuildSettings.cmake ) diff --git a/dox/externalproject/CMakeLists.txt b/dox/externalproject/CMakeLists.txt index bf7bc5bc8..ef8532d41 100644 --- a/dox/externalproject/CMakeLists.txt +++ b/dox/externalproject/CMakeLists.txt @@ -1,7 +1,7 @@ # Example project for using elastix code from external projects. PROJECT( elxExternalProject ) -CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.5.1 ) # Find TIK FIND_PACKAGE( ITK REQUIRED ) From ff86021df5fc2106e22f045cd60dc60e5602c5fa Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 16 Feb 2018 13:12:38 +0100 Subject: [PATCH 2/8] STYLE: Removed code related to elxLibraryDepends.cmake Discussed w/ Marius and kasper: Backward compatibility with respect to elxLibraryDepends.cmake (elxLIBRARY_DEPENDS_FILE) no longer needs to be supported. --- CMakeLists.txt | 7 +------ ElastixConfig.cmake.in | 1 - UseElastix.cmake.in | 7 +------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db6a877b..a88e07388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -541,12 +541,7 @@ endif() # Make it easier to include elastix functionality in other programs. # Save library dependencies. -# The library dependencies file. -set( elxLIBRARY_DEPENDS_FILE ${elastix_BINARY_DIR}/elxLibraryDepends.cmake ) -# TODO Replace the original command, -# export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) -# by export() and install(EXPORT) commands -# See https://cmake.org/cmake/help/v3.10/policy/CMP0033.html + # The build settings file. (necessary for elastix?) #set( ITK_BUILD_SETTINGS_FILE ${ITK_BINARY_DIR}/ITKBuildSettings.cmake ) diff --git a/ElastixConfig.cmake.in b/ElastixConfig.cmake.in index 70193fde0..79545c04a 100644 --- a/ElastixConfig.cmake.in +++ b/ElastixConfig.cmake.in @@ -24,4 +24,3 @@ set( ELASTIX_HELP_DIR @ELASTIX_HELP_DIR@ ) # Maintain backwards compatibility by also exporting old-style target information set( ELASTIX_ALL_COMPONENT_LIBS @AllComponentLibs@ ) -set( elxLIBRARY_DEPENDS_FILE @elxLIBRARY_DEPENDS_FILE@ ) diff --git a/UseElastix.cmake.in b/UseElastix.cmake.in index 5614aa256..a30609f30 100644 --- a/UseElastix.cmake.in +++ b/UseElastix.cmake.in @@ -14,13 +14,8 @@ include_directories( ${ELASTIX_INCLUDE_DIRS} ) link_directories( ${ELASTIX_LIBRARY_DIRS} ) # If Elastix_FOUND is set, this file is included via find_package() which provides -# ELASTIX_CONFIG_TARGETS_FILE and elxLIBRARY_DEPENDS_FILE. Guarding the following -# include statements allow users to include this file directly for backwards -# compatibility. +# ELASTIX_CONFIG_TARGETS_FILE. if( Elastix_FOUND ) # This file was found by find_package include( ${ELASTIX_CONFIG_TARGETS_FILE} ) -else() - # Include linking dependency info for backwards compatibility - include( ${elxLIBRARY_DEPENDS_FILE} ) endif() From b46b05e0c92b236bf9e4dc2d51f21753be132d60 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 20 Feb 2018 16:16:59 +0100 Subject: [PATCH 3/8] STYLE: Removed ELASTIX_ALL_COMPONENT from elxLibraryDepends.cmake. Also removed foreach( LIB IN LISTS AllComponentLibs ), as discussed w/ Kasper. Related to #21. --- CMakeLists.txt | 4 ---- ElastixConfig.cmake.in | 3 --- 2 files changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a88e07388..47da780bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -549,10 +549,6 @@ endif() elastix_export_target( elastix ) elastix_export_target( transformix ) -foreach( LIB IN LISTS AllComponentLibs ) - elastix_export_target( ${LIB} ) -endforeach() - configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfig.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfig.cmake @ONLY ) configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfigVersion.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfigVersion.cmake @ONLY ) configure_file( ${CMAKE_SOURCE_DIR}/UseElastix.cmake.in ${CMAKE_BINARY_DIR}/UseElastix.cmake @ONLY ) diff --git a/ElastixConfig.cmake.in b/ElastixConfig.cmake.in index 79545c04a..e540105aa 100644 --- a/ElastixConfig.cmake.in +++ b/ElastixConfig.cmake.in @@ -21,6 +21,3 @@ set( ELASTIX_USE_OPENCL @ELASTIX_USE_OPENCL@ ) set( ELASTIX_USE_MEVISDICOMTIFF @ELASTIX_USE_MEVISDICOMTIFF@ ) set( ELASTIX_DOX_DIR @ELASTIX_DOX_DIR@ ) set( ELASTIX_HELP_DIR @ELASTIX_HELP_DIR@ ) - -# Maintain backwards compatibility by also exporting old-style target information -set( ELASTIX_ALL_COMPONENT_LIBS @AllComponentLibs@ ) From 9b814e9681ae4f56cd6d9ce9e54efe77b200a5cf Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 20 Feb 2018 16:20:09 +0100 Subject: [PATCH 4/8] STYLE: Now unconditionally include(${ELASTIX_CONFIG_TARGETS_FILE}), as discussed w/ Kasper. Related to #21. --- UseElastix.cmake.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/UseElastix.cmake.in b/UseElastix.cmake.in index a30609f30..56bcd09fa 100644 --- a/UseElastix.cmake.in +++ b/UseElastix.cmake.in @@ -13,9 +13,5 @@ include_directories( ${ELASTIX_INCLUDE_DIRS} ) # Add library dirs link_directories( ${ELASTIX_LIBRARY_DIRS} ) -# If Elastix_FOUND is set, this file is included via find_package() which provides -# ELASTIX_CONFIG_TARGETS_FILE. -if( Elastix_FOUND ) - # This file was found by find_package - include( ${ELASTIX_CONFIG_TARGETS_FILE} ) -endif() +# This file was found by find_package +include( ${ELASTIX_CONFIG_TARGETS_FILE} ) From 1445324c655c957b5e0cbca3aba329a306e33514 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 14 Feb 2018 17:04:04 +0100 Subject: [PATCH 5/8] COMP: Set cmake_minimum_required to 3.5.1, removed old policies, to fix #21 Note: it should still be seen if this commit does not break anything: * https://travis-ci.org/SuperElastix/elastix should support the new CMake version requirement * CMP0007, the new way empty list items are supported should be OK with elastix. * CMP0033: The removal of export_library_dependencies should be OK with elastix. cmake_minimum_required is chosen to be in sync with SuperElastix. --- CMakeLists.txt | 15 +++++---------- dox/externalproject/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bba09a7c..0db6a877b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,9 @@ -cmake_minimum_required( VERSION 2.8 ) +cmake_minimum_required( VERSION 3.5.1 ) project( elastix ) #--------------------------------------------------------------------- cmake_policy( SET CMP0012 NEW ) -if( POLICY CMP0033 ) - # This policy was introduced in cmake 3, so we need to check for its - # existence. When the minimum cmake version above is upgraded to 3 - # this if(POLICY) check can be removed. - cmake_policy( SET CMP0033 OLD ) -endif() - -cmake_policy( SET CMP0007 OLD ) cmake_policy( SET CMP0042 NEW ) #--------------------------------------------------------------------- @@ -551,7 +543,10 @@ endif() # Save library dependencies. # The library dependencies file. set( elxLIBRARY_DEPENDS_FILE ${elastix_BINARY_DIR}/elxLibraryDepends.cmake ) -export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) +# TODO Replace the original command, +# export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) +# by export() and install(EXPORT) commands +# See https://cmake.org/cmake/help/v3.10/policy/CMP0033.html # The build settings file. (necessary for elastix?) #set( ITK_BUILD_SETTINGS_FILE ${ITK_BINARY_DIR}/ITKBuildSettings.cmake ) diff --git a/dox/externalproject/CMakeLists.txt b/dox/externalproject/CMakeLists.txt index bf7bc5bc8..ef8532d41 100644 --- a/dox/externalproject/CMakeLists.txt +++ b/dox/externalproject/CMakeLists.txt @@ -1,7 +1,7 @@ # Example project for using elastix code from external projects. PROJECT( elxExternalProject ) -CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.5.1 ) # Find TIK FIND_PACKAGE( ITK REQUIRED ) From c32fc5861bde8605565bcbc44866c6553c19ae44 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 16 Feb 2018 13:12:38 +0100 Subject: [PATCH 6/8] STYLE: Removed code related to elxLibraryDepends.cmake Discussed w/ Marius and kasper: Backward compatibility with respect to elxLibraryDepends.cmake (elxLIBRARY_DEPENDS_FILE) no longer needs to be supported. --- CMakeLists.txt | 7 +------ ElastixConfig.cmake.in | 1 - UseElastix.cmake.in | 7 +------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db6a877b..a88e07388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -541,12 +541,7 @@ endif() # Make it easier to include elastix functionality in other programs. # Save library dependencies. -# The library dependencies file. -set( elxLIBRARY_DEPENDS_FILE ${elastix_BINARY_DIR}/elxLibraryDepends.cmake ) -# TODO Replace the original command, -# export_library_dependencies( ${elxLIBRARY_DEPENDS_FILE} ) -# by export() and install(EXPORT) commands -# See https://cmake.org/cmake/help/v3.10/policy/CMP0033.html + # The build settings file. (necessary for elastix?) #set( ITK_BUILD_SETTINGS_FILE ${ITK_BINARY_DIR}/ITKBuildSettings.cmake ) diff --git a/ElastixConfig.cmake.in b/ElastixConfig.cmake.in index 70193fde0..79545c04a 100644 --- a/ElastixConfig.cmake.in +++ b/ElastixConfig.cmake.in @@ -24,4 +24,3 @@ set( ELASTIX_HELP_DIR @ELASTIX_HELP_DIR@ ) # Maintain backwards compatibility by also exporting old-style target information set( ELASTIX_ALL_COMPONENT_LIBS @AllComponentLibs@ ) -set( elxLIBRARY_DEPENDS_FILE @elxLIBRARY_DEPENDS_FILE@ ) diff --git a/UseElastix.cmake.in b/UseElastix.cmake.in index 5614aa256..a30609f30 100644 --- a/UseElastix.cmake.in +++ b/UseElastix.cmake.in @@ -14,13 +14,8 @@ include_directories( ${ELASTIX_INCLUDE_DIRS} ) link_directories( ${ELASTIX_LIBRARY_DIRS} ) # If Elastix_FOUND is set, this file is included via find_package() which provides -# ELASTIX_CONFIG_TARGETS_FILE and elxLIBRARY_DEPENDS_FILE. Guarding the following -# include statements allow users to include this file directly for backwards -# compatibility. +# ELASTIX_CONFIG_TARGETS_FILE. if( Elastix_FOUND ) # This file was found by find_package include( ${ELASTIX_CONFIG_TARGETS_FILE} ) -else() - # Include linking dependency info for backwards compatibility - include( ${elxLIBRARY_DEPENDS_FILE} ) endif() From c745754bf2e0094140fad408b98ae03b1e4dc484 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 20 Feb 2018 16:16:59 +0100 Subject: [PATCH 7/8] STYLE: Removed ELASTIX_ALL_COMPONENT from elxLibraryDepends.cmake. Also removed foreach( LIB IN LISTS AllComponentLibs ), as discussed w/ Kasper. Related to #21. --- CMakeLists.txt | 4 ---- ElastixConfig.cmake.in | 3 --- 2 files changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a88e07388..47da780bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -549,10 +549,6 @@ endif() elastix_export_target( elastix ) elastix_export_target( transformix ) -foreach( LIB IN LISTS AllComponentLibs ) - elastix_export_target( ${LIB} ) -endforeach() - configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfig.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfig.cmake @ONLY ) configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfigVersion.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfigVersion.cmake @ONLY ) configure_file( ${CMAKE_SOURCE_DIR}/UseElastix.cmake.in ${CMAKE_BINARY_DIR}/UseElastix.cmake @ONLY ) diff --git a/ElastixConfig.cmake.in b/ElastixConfig.cmake.in index 79545c04a..e540105aa 100644 --- a/ElastixConfig.cmake.in +++ b/ElastixConfig.cmake.in @@ -21,6 +21,3 @@ set( ELASTIX_USE_OPENCL @ELASTIX_USE_OPENCL@ ) set( ELASTIX_USE_MEVISDICOMTIFF @ELASTIX_USE_MEVISDICOMTIFF@ ) set( ELASTIX_DOX_DIR @ELASTIX_DOX_DIR@ ) set( ELASTIX_HELP_DIR @ELASTIX_HELP_DIR@ ) - -# Maintain backwards compatibility by also exporting old-style target information -set( ELASTIX_ALL_COMPONENT_LIBS @AllComponentLibs@ ) From dc84f14c5a42b237d32543d13b5cf6a5aa055869 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 20 Feb 2018 16:20:09 +0100 Subject: [PATCH 8/8] STYLE: Now unconditionally include(${ELASTIX_CONFIG_TARGETS_FILE}), as discussed w/ Kasper. Related to #21. --- UseElastix.cmake.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/UseElastix.cmake.in b/UseElastix.cmake.in index a30609f30..56bcd09fa 100644 --- a/UseElastix.cmake.in +++ b/UseElastix.cmake.in @@ -13,9 +13,5 @@ include_directories( ${ELASTIX_INCLUDE_DIRS} ) # Add library dirs link_directories( ${ELASTIX_LIBRARY_DIRS} ) -# If Elastix_FOUND is set, this file is included via find_package() which provides -# ELASTIX_CONFIG_TARGETS_FILE. -if( Elastix_FOUND ) - # This file was found by find_package - include( ${ELASTIX_CONFIG_TARGETS_FILE} ) -endif() +# This file was found by find_package +include( ${ELASTIX_CONFIG_TARGETS_FILE} )