Skip to content

Commit b183e1b

Browse files
authored
Merge pull request #60 from dzenanz/master
Improve compatibility with ITK 4.13
2 parents 4e9f605 + 9b43db5 commit b183e1b

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

CMakeLists.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
cmake_minimum_required(VERSION 3.10.2)
22

3+
if(NOT CMAKE_CXX_STANDARD)
4+
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
5+
endif()
6+
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
endif()
9+
if(NOT CMAKE_CXX_EXTENSIONS)
10+
set(CMAKE_CXX_EXTENSIONS OFF)
11+
endif()
12+
313
## If building external to ITK, we need to capture
414
## required build setting from ITK prior to calling
515
## project()
616
if(NOT ITK_SOURCE_DIR)
717
find_package(ITK REQUIRED)
818
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
9-
if(ITK_VERSION_MAJOR GREATER 4 )
10-
if(NOT CMAKE_CXX_STANDARD)
11-
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
12-
endif()
13-
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
14-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
15-
endif()
16-
if(NOT CMAKE_CXX_EXTENSIONS)
17-
set(CMAKE_CXX_EXTENSIONS OFF)
18-
endif()
1919

20-
foreach(p
21-
## Only policies introduced after the cmake_minimum_required
22-
## version need to explicitly be set to NEW.
23-
CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
24-
CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
25-
)
26-
if(POLICY ${p})
27-
cmake_policy(SET ${p} NEW)
28-
endif()
29-
endforeach()
30-
endif()
20+
foreach(p
21+
## Only policies introduced after the cmake_minimum_required
22+
## version need to explicitly be set to NEW.
23+
CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
24+
CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
25+
)
26+
if(POLICY ${p})
27+
cmake_policy(SET ${p} NEW)
28+
endif()
29+
endforeach()
3130

3231

3332
# Set a default build type if none was specified
@@ -49,6 +48,7 @@ include_directories(${CMAKE_BINARY_DIR})
4948
if(NOT ITK_SOURCE_DIR)
5049
include(ITKModuleExternal)
5150
else()
51+
set(ITK_DIR ${CMAKE_BINARY_DIR})
5252
itk_module_impl()
5353
endif()
5454
add_subdirectory(examples)

src/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# An option to allow building against ITK before 2018-02-20 when itkBuildInformation.h was not available
2-
option(ITK_HAS_INFORMATION_H "If itk::BuildInformation::GetInstance is available (after 2018-02-20)" ON)
2+
if (ITK_VERSION_MAJOR LESS 5)
3+
set(HAS_INFO OFF)
4+
else()
5+
set(HAS_INFO ON)
6+
endif()
7+
option(ITK_HAS_INFORMATION_H "If itk::BuildInformation::GetInstance is available (after 2018-02-20)" ${HAS_INFO})
38

49
include(${CMAKE_CURRENT_LIST_DIR}/../CMake/GetGitRevisionDescription.cmake)
510
get_git_head_revision(GIT_CONFIG_REFSPEC GIT_CONFIG_SHA1)

0 commit comments

Comments
 (0)