|
| 1 | +commit 4fed5f285030085b096c930ff03e42c7814739b2 |
| 2 | +Author: Juan Ramos < [email protected]> |
| 3 | +Date: Mon Jun 19 11:21:44 2023 -0600 |
| 4 | + |
| 5 | + cmake: Raise min to 3.6 |
| 6 | + |
| 7 | + From the CMake 3.27 release notes: |
| 8 | + Compatibility with versions of CMake older than 3.5 is now |
| 9 | + deprecated and will be removed from a future version. Calls to |
| 10 | + cmake_minimum_required() or cmake_policy() that set the policy |
| 11 | + version to an older value now issue a deprecation diagnostic. |
| 12 | + |
| 13 | + This PR also removes manually setting policy CMP0048. This is |
| 14 | + redundant since the CMake min is already 3.X |
| 15 | + |
| 16 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 17 | +index 6af41437..33a6c6ff 100644 |
| 18 | +--- a/CMakeLists.txt |
| 19 | ++++ b/CMakeLists.txt |
| 20 | +@@ -1,11 +1,7 @@ |
| 21 | + # Note: CMake support is community-based. The maintainers do not use CMake |
| 22 | + # internally. |
| 23 | + |
| 24 | +-cmake_minimum_required(VERSION 3.5) |
| 25 | +- |
| 26 | +-if (POLICY CMP0048) |
| 27 | +- cmake_policy(SET CMP0048 NEW) |
| 28 | +-endif (POLICY CMP0048) |
| 29 | ++cmake_minimum_required(VERSION 3.6) |
| 30 | + |
| 31 | + if (POLICY CMP0069) |
| 32 | + cmake_policy(SET CMP0069 NEW) |
| 33 | +diff --git a/docs/pkgconfig.md b/docs/pkgconfig.md |
| 34 | +index 18a2546a..bf05d593 100644 |
| 35 | +--- a/docs/pkgconfig.md |
| 36 | ++++ b/docs/pkgconfig.md |
| 37 | +@@ -19,19 +19,15 @@ examples here we assume you want to compile the sample |
| 38 | + Using `pkg-config` in CMake is fairly easy: |
| 39 | + |
| 40 | + ```cmake |
| 41 | +-cmake_minimum_required(VERSION 3.0) |
| 42 | +- |
| 43 | +-cmake_policy(SET CMP0048 NEW) |
| 44 | +-project(my_gtest_pkgconfig VERSION 0.0.1 LANGUAGES CXX) |
| 45 | +- |
| 46 | + find_package(PkgConfig) |
| 47 | + pkg_search_module(GTEST REQUIRED gtest_main) |
| 48 | + |
| 49 | +-add_executable(testapp samples/sample3_unittest.cc) |
| 50 | +-target_link_libraries(testapp ${GTEST_LDFLAGS}) |
| 51 | +-target_compile_options(testapp PUBLIC ${GTEST_CFLAGS}) |
| 52 | ++add_executable(testapp) |
| 53 | ++target_sources(testapp PRIVATE samples/sample3_unittest.cc) |
| 54 | ++target_link_libraries(testapp PRIVATE ${GTEST_LDFLAGS}) |
| 55 | ++target_compile_options(testapp PRIVATE ${GTEST_CFLAGS}) |
| 56 | + |
| 57 | +-include(CTest) |
| 58 | ++enable_testing() |
| 59 | + add_test(first_and_only_test testapp) |
| 60 | + ``` |
| 61 | + |
| 62 | +diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt |
| 63 | +index 5c1f0daf..444c5ae8 100644 |
| 64 | +--- a/googlemock/CMakeLists.txt |
| 65 | ++++ b/googlemock/CMakeLists.txt |
| 66 | +@@ -36,8 +36,7 @@ endif() |
| 67 | + # as ${gmock_SOURCE_DIR} and to the root binary directory as |
| 68 | + # ${gmock_BINARY_DIR}. |
| 69 | + # Language "C" is required for find_package(Threads). |
| 70 | +-cmake_minimum_required(VERSION 3.5) |
| 71 | +-cmake_policy(SET CMP0048 NEW) |
| 72 | ++cmake_minimum_required(VERSION 3.6) |
| 73 | + project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) |
| 74 | + |
| 75 | + if (COMMAND set_up_hermetic_build) |
| 76 | +diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt |
| 77 | +index d06c1479..efc2c3cb 100644 |
| 78 | +--- a/googletest/CMakeLists.txt |
| 79 | ++++ b/googletest/CMakeLists.txt |
| 80 | +@@ -46,8 +46,7 @@ endif() |
| 81 | + |
| 82 | + # Project version: |
| 83 | + |
| 84 | +-cmake_minimum_required(VERSION 3.5) |
| 85 | +-cmake_policy(SET CMP0048 NEW) |
| 86 | ++cmake_minimum_required(VERSION 3.6) |
| 87 | + project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) |
| 88 | + |
| 89 | + if (POLICY CMP0063) # Visibility |
0 commit comments