Skip to content

Commit cbe6fbb

Browse files
committed
COMP: Set minimum CMAKE_CXX_STANDARD for Remote/Modules
When building remote modules outside of ITK, the CMAKE_CXX_STANDARD must be defaulted to at least the same standard as ITK was built against. If not explicitly set, initialize external modules to the same standard as ITK. ```bash git clone https://github.com/InsightSoftwareConsortium/ITKTotalVariation.git cd ITKTotalVariation cmake -S . -B cmake-build-release \ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \ -DBUILD_TESTING=ON -DITK_DIR=../ITK/build-python ninja -C cmake-build-release ```
1 parent bec83f1 commit cbe6fbb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CMake/ITKConfig.cmake.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@ set(ITK_WRAPPING "@ITK_WRAPPING@")
116116
# ITK_WRAP_DOC is disabled by default.
117117

118118
# expose C++ standard used to build ITK for supporting external packages
119-
set(ITK_CXX_STANDARD CMAKE_CXX_STANDARD)
120-
119+
set(ITK_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
120+
if( NOT DEFINED CMAKE_CXX_STANDARD )
121+
# If not explicitly set, initialize external modules to the same standard as ITK.
122+
set(CMAKE_CXX_STANDARD ${ITK_CXX_STANDARD})
123+
endif()
121124
if( NOT DEFINED ITK_WRAP_PYTHON)
122125
set(ITK_WRAP_PYTHON "@ITK_WRAP_PYTHON@")
123126
endif()

0 commit comments

Comments
 (0)