Skip to content

Commit 7d32ddf

Browse files
committed
COMP: allow building against 4.13 out of source
1 parent 4e9f605 commit 7d32ddf

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

CMakeLists.txt

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,26 @@ cmake_minimum_required(VERSION 3.10.2)
66
if(NOT ITK_SOURCE_DIR)
77
find_package(ITK REQUIRED)
88
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()
19-
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()
9+
if(NOT CMAKE_CXX_STANDARD)
10+
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
3011
endif()
12+
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
13+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
14+
endif()
15+
if(NOT CMAKE_CXX_EXTENSIONS)
16+
set(CMAKE_CXX_EXTENSIONS OFF)
17+
endif()
18+
19+
foreach(p
20+
## Only policies introduced after the cmake_minimum_required
21+
## version need to explicitly be set to NEW.
22+
CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
23+
CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
24+
)
25+
if(POLICY ${p})
26+
cmake_policy(SET ${p} NEW)
27+
endif()
28+
endforeach()
3129

3230

3331
# Set a default build type if none was specified

0 commit comments

Comments
 (0)