changeset 6070:33e6860e34d7

added compatibility with cmake 4.0 that does not accept cmake files older < 3.5
author Alain Mazy <am@orthanc.team>
date Tue, 01 Apr 2025 17:55:10 +0200
parents 0d587d1898a8
children 7175e985450f
files OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake OrthancFramework/Resources/CMake/WebAssembly/ArithmeticTests/CMakeLists.txt OrthancFramework/Resources/DcmtkTools/CMakeLists.txt OrthancFramework/Resources/ProtocolBuffers/CMakeLists.txt OrthancFramework/Resources/Samples/MicroService/CMakeLists.txt OrthancFramework/Resources/ThirdParty/icu/CMakeLists.txt OrthancFramework/SharedLibrary/CMakeLists.txt OrthancFramework/UnitTestsSources/CMakeLists.txt OrthancServer/CMakeLists.txt OrthancServer/Plugins/Samples/AutomatedJpeg2kCompression/CMakeLists.txt OrthancServer/Plugins/Samples/Basic/CMakeLists.txt OrthancServer/Plugins/Samples/Common/OrthancPlugins.cmake OrthancServer/Plugins/Samples/ConnectivityChecks/CMakeLists.txt OrthancServer/Plugins/Samples/CustomImageDecoder/CMakeLists.txt OrthancServer/Plugins/Samples/DelayedDeletion/CMakeLists.txt OrthancServer/Plugins/Samples/ModalityWorklists/CMakeLists.txt OrthancServer/Plugins/Samples/MultitenantDicom/CMakeLists.txt OrthancServer/Plugins/Samples/Sanitizer/CMakeLists.txt OrthancServer/Plugins/Samples/ServeFolders/CMakeLists.txt OrthancServer/Plugins/Samples/StorageArea/CMakeLists.txt OrthancServer/Plugins/Samples/StorageCommitmentScp/CMakeLists.txt OrthancServer/Plugins/Samples/WebDavFilesystem/CMakeLists.txt OrthancServer/Plugins/Samples/WebSkeleton/CMakeLists.txt OrthancServer/Resources/Samples/Tools/CMakeLists.txt OrthancServer/Resources/Testing/Issue32/Cpp/CMakeLists.txt
diffstat 26 files changed, 50 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Tue Apr 01 17:55:10 2025 +0200
@@ -501,7 +501,15 @@
   
   include(CheckIncludeFile)
   include(CheckIncludeFileCXX)
-  include(FindPythonInterp)
+  
+  if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
+    # Use FindPython for CMake 3.12 and later
+    find_package(Python REQUIRED COMPONENTS Interpreter)
+  else()
+    # Use FindPythonInterp for versions earlier than 3.12
+    include(FindPythonInterp)
+  endif()
+  
   include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
   include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
   include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Tue Apr 01 17:55:10 2025 +0200
@@ -43,8 +43,14 @@
 include(CheckStructHasMember)
 include(CheckSymbolExists)
 include(CheckTypeSize)
-include(FindPythonInterp)
-  
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
+  # Use FindPython for CMake 3.12 and later
+  find_package(Python REQUIRED COMPONENTS Interpreter)
+else()
+  # Use FindPythonInterp for versions earlier than 3.12
+  include(FindPythonInterp)
+endif()
+
 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
--- a/OrthancFramework/Resources/CMake/WebAssembly/ArithmeticTests/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/CMake/WebAssembly/ArithmeticTests/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -29,7 +29,7 @@
 # -> Copy the result as "../arith.h"
 
 
-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.3...4.0)
 
 
 #####################################################################
--- a/OrthancFramework/Resources/DcmtkTools/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/DcmtkTools/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -22,7 +22,7 @@
 
 #   $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../Resources/Toolchains/LinuxStandardBaseToolchain.cmake -G Ninja
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(DcmtkTools)
 
--- a/OrthancFramework/Resources/ProtocolBuffers/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/ProtocolBuffers/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -20,7 +20,7 @@
 # <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.3...4.0)
 
 project(ProtocolBuffers)
 
--- a/OrthancFramework/Resources/Samples/MicroService/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/Samples/MicroService/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -20,7 +20,7 @@
 # <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Sample)
 
--- a/OrthancFramework/Resources/ThirdParty/icu/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/Resources/ThirdParty/icu/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -20,7 +20,7 @@
 # <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 project(IcuCodeGeneration)
 
 set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")
--- a/OrthancFramework/SharedLibrary/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/SharedLibrary/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -30,7 +30,7 @@
 ##
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 cmake_policy(SET CMP0058 NEW)
 
 project(OrthancFramework)
--- a/OrthancFramework/UnitTestsSources/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancFramework/UnitTestsSources/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -24,7 +24,7 @@
 ## This file is meant to be used only by ../SharedLibrary/CMakeLists.txt
 ##
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 project(UnitTestsProject)
 
 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
--- a/OrthancServer/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 cmake_policy(SET CMP0058 NEW)
 
 project(Orthanc)
--- a/OrthancServer/Plugins/Samples/AutomatedJpeg2kCompression/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/AutomatedJpeg2kCompression/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Basic)
 
--- a/OrthancServer/Plugins/Samples/Basic/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/Basic/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Basic)
 
--- a/OrthancServer/Plugins/Samples/Common/OrthancPlugins.cmake	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/Common/OrthancPlugins.cmake	Tue Apr 01 17:55:10 2025 +0200
@@ -22,7 +22,16 @@
 include(CheckIncludeFiles)
 include(CheckIncludeFileCXX)
 include(CheckLibraryExists)
-include(FindPythonInterp)
+
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
+  # Use FindPython for CMake 3.12 and later
+  find_package(Python REQUIRED COMPONENTS Interpreter)
+else()
+  # Use FindPythonInterp for versions earlier than 3.12
+  include(FindPythonInterp)
+endif()
+
+
 include(${CMAKE_CURRENT_LIST_DIR}/../../../../OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/../../../../OrthancFramework/Resources/CMake/DownloadPackage.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/../../../../OrthancFramework/Resources/CMake/Compiler.cmake)
--- a/OrthancServer/Plugins/Samples/ConnectivityChecks/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/ConnectivityChecks/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 cmake_policy(SET CMP0058 NEW)
 
 project(ConnectivityChecks)
--- a/OrthancServer/Plugins/Samples/CustomImageDecoder/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/CustomImageDecoder/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(CustomImageDecoder)
 
--- a/OrthancServer/Plugins/Samples/DelayedDeletion/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/DelayedDeletion/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 cmake_policy(SET CMP0058 NEW)
 
 project(DelayedDeletion)
--- a/OrthancServer/Plugins/Samples/ModalityWorklists/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/ModalityWorklists/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(ModalityWorklists)
 
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/MultitenantDicom/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(MultitenantDicom)
 
--- a/OrthancServer/Plugins/Samples/Sanitizer/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/Sanitizer/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Sanitizer)
 
--- a/OrthancServer/Plugins/Samples/ServeFolders/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/ServeFolders/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(ServeFolders)
 
--- a/OrthancServer/Plugins/Samples/StorageArea/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/StorageArea/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Basic)
 
--- a/OrthancServer/Plugins/Samples/StorageCommitmentScp/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/StorageCommitmentScp/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(StorageCommitmentScp)
 
--- a/OrthancServer/Plugins/Samples/WebDavFilesystem/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/WebDavFilesystem/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(WebDavFilesystem)
 
--- a/OrthancServer/Plugins/Samples/WebSkeleton/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Plugins/Samples/WebSkeleton/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(WebSkeleton)
 
--- a/OrthancServer/Resources/Samples/Tools/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Resources/Samples/Tools/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(OrthancTools)
 
--- a/OrthancServer/Resources/Testing/Issue32/Cpp/CMakeLists.txt	Tue Apr 01 15:46:15 2025 +0200
+++ b/OrthancServer/Resources/Testing/Issue32/Cpp/CMakeLists.txt	Tue Apr 01 17:55:10 2025 +0200
@@ -19,7 +19,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...4.0)
 
 project(Orthanc)