Skip to content

Commit

Permalink
COMP: Fix CMake configuration for cmake versions without CMP0135
Browse files Browse the repository at this point in the history
Fixes compilation error introduced by commit
7972041 for versions prior to CMake 3.24:

CMake Error at Utilities/ClangFormat/DownloadClangFormat.cmake:47 (cmake_policy):
  Policy "CMP0135" is not known to this version of CMake.
Call Stack (most recent call first):
  CMake/ITKModuleClangFormat.cmake:17 (include)
  CMake/ITKModuleMacros.cmake:9 (include)
  CMakeLists.txt:146 (include)
  • Loading branch information
Simon Rit authored and dzenanz committed Jan 19, 2024
1 parent 0986226 commit 8d1fac4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Utilities/ClangFormat/DownloadClangFormat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ endif()
if(ITK_FORBID_DOWNLOADS)
message(SEND_ERROR "Attempted to download ClangFormat when ITK_FORBID_DOWNLOADS is ON")
endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0135 NEW)
if(POLICY CMP0135)
cmake_policy(PUSH)
cmake_policy(SET CMP0135 NEW)
endif()
if(NOT TARGET ClangFormat AND _clang_format_hash)
ExternalProject_Add(
ClangFormat
Expand All @@ -60,4 +62,6 @@ if(NOT TARGET ClangFormat AND _clang_format_hash)
LOG_INSTALL 0
INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/ITKClangFormatConfig.cmake)
endif()
cmake_policy(POP)
if(POLICY CMP0135)
cmake_policy(POP)
endif()

0 comments on commit 8d1fac4

Please sign in to comment.