Skip to content

Commit

Permalink
COMP: Initialize CXX standard in ITK_USE_FILE
Browse files Browse the repository at this point in the history
Code that builds against ITK may not be built with a sufficient or
compatible C++ standard.

Use ITKInitializeCXXStandard.cmake in client code, which calls

  include(${ITK_USE_FILE})

according to our existing documentation, which will set
CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED if not already set.

To address build errors as discussed in:

  https://discourse.itk.org/t/hello-world-from-itk-examples-installation-not-compiling-for-itk-5-3/4441/8
  • Loading branch information
thewtex committed Oct 3, 2021
1 parent ed5c976 commit 9233ef9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMake/UseITK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ITK_REQUIRED_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")
include(${ITK_CMAKE_DIR}/ITKInitializeCXXStandard.cmake)

# Add include directories needed to use ITK.
include_directories(BEFORE ${ITK_INCLUDE_DIRS})
Expand Down

0 comments on commit 9233ef9

Please sign in to comment.