From 73b2369c71f5710126f9c98e8ae6d9a735ca797e Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Mon, 29 Apr 2024 15:48:02 -0700 Subject: [PATCH] Adding CMake version support ranges Adding the supported version ranges to each project. The newer versions of CMake have better support with some of the newer policies. Specifically CMP0157 in CMake 3.29 improves the incremental rebuild performance and hooks up the emissions of compile commands for Swift so that folks with Sourcekit-LSP can have a better editing experience. --- 1_single_executable/CMakeLists.txt | 2 +- 2_executable_library/CMakeLists.txt | 2 +- 3_bidirectional_cxx_interop/CMakeLists.txt | 2 +- 4_swift_macros/CMakeLists.txt | 6 +----- 4_swift_macros/StringifyMacro/CMakeLists.txt | 5 +---- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/1_single_executable/CMakeLists.txt b/1_single_executable/CMakeLists.txt index 05d4d5d..69f5e07 100644 --- a/1_single_executable/CMakeLists.txt +++ b/1_single_executable/CMakeLists.txt @@ -5,7 +5,7 @@ # # See https://swift.org/LICENSE.txt for license information -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.22...3.29) project(hello LANGUAGES Swift) diff --git a/2_executable_library/CMakeLists.txt b/2_executable_library/CMakeLists.txt index e6641ea..b1d9f27 100644 --- a/2_executable_library/CMakeLists.txt +++ b/2_executable_library/CMakeLists.txt @@ -5,7 +5,7 @@ # # See https://swift.org/LICENSE.txt for license information -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.22...3.29) project(Project2 LANGUAGES Swift) add_subdirectory("lib/") diff --git a/3_bidirectional_cxx_interop/CMakeLists.txt b/3_bidirectional_cxx_interop/CMakeLists.txt index 435cebf..cfe3682 100644 --- a/3_bidirectional_cxx_interop/CMakeLists.txt +++ b/3_bidirectional_cxx_interop/CMakeLists.txt @@ -5,7 +5,7 @@ # # See https://swift.org/LICENSE.txt for license information -cmake_minimum_required(VERSION 3.26) +cmake_minimum_required(VERSION 3.26...3.29) # Project PingPong: Bouncing control flow between Swift and C++ like a ping pong # ball. diff --git a/4_swift_macros/CMakeLists.txt b/4_swift_macros/CMakeLists.txt index 23227c5..9a5d25e 100644 --- a/4_swift_macros/CMakeLists.txt +++ b/4_swift_macros/CMakeLists.txt @@ -5,11 +5,7 @@ # # See https://swift.org/LICENSE.txt for license information -cmake_minimum_required(VERSION 3.22) - -if(POLICY CMP0157) - cmake_policy(SET CMP0157 NEW) -endif() +cmake_minimum_required(VERSION 3.22...3.29) project(StringifyMacroExample LANGUAGES Swift) diff --git a/4_swift_macros/StringifyMacro/CMakeLists.txt b/4_swift_macros/StringifyMacro/CMakeLists.txt index b2c2625..fa990a3 100644 --- a/4_swift_macros/StringifyMacro/CMakeLists.txt +++ b/4_swift_macros/StringifyMacro/CMakeLists.txt @@ -5,10 +5,7 @@ # # See https://swift.org/LICENSE.txt for license information -cmake_minimum_required(VERSION 3.22) -if(POLICY CMP0157) - cmake_policy(SET CMP0157 NEW) -endif() +cmake_minimum_required(VERSION 3.22...3.29) project(StringifyMacro LANGUAGES Swift)