From 9094eaa778ce45c7e2c357a9067cf9556df6426e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Dec 2024 14:12:55 -0500 Subject: [PATCH] CMP0044: Remove support for OLD behavior --- Help/policy/CMP0044.rst | 9 ++++---- Source/cmGeneratorExpressionNode.cxx | 17 -------------- Source/cmPolicies.h | 2 +- .../CMP0044/CMakeLists.txt | 9 ++------ .../CMP0044/cmp0044-check.cpp | 23 ++----------------- Tests/GeneratorExpression/CMakeLists.txt | 8 +------ .../CMP0044-WARN-result.txt | 1 - .../CMP0044-WARN-stderr.txt | 7 ------ .../GeneratorExpression/CMP0044-WARN.cmake | 17 -------------- .../GeneratorExpression/CMakeLists.txt | 3 --- .../GeneratorExpression/RunCMakeTest.cmake | 1 - Tests/RunCMake/PolicyScope/CMakeLists.txt | 2 +- Tests/RunCMake/PolicyScope/RunCMakeTest.cmake | 3 --- .../dir-in-macro-generate-time-result.txt | 1 - .../dir-in-macro-generate-time-stderr.txt | 5 ---- .../dir-in-macro-generate-time.cmake | 2 -- .../PolicyScope/dir-in-macro-include.cmake | 6 ----- .../RunCMake/PolicyScope/dir1/CMakeLists.txt | 5 ---- Tests/RunCMake/PolicyScope/dir1/foo.cpp | 5 ---- .../parent-dir-generate-time.cmake | 7 ------ 20 files changed, 12 insertions(+), 121 deletions(-) delete mode 100644 Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake delete mode 100644 Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt delete mode 100644 Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt delete mode 100644 Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake delete mode 100644 Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake delete mode 100644 Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt delete mode 100644 Tests/RunCMake/PolicyScope/dir1/foo.cpp delete mode 100644 Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 36c2839d15..9ee1be1676 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -1,6 +1,9 @@ CMP0044 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Case sensitive ``_COMPILER_ID`` generator expressions CMake 2.8.12 introduced the ``_COMPILER_ID`` @@ -15,7 +18,5 @@ for this policy is to perform a case-sensitive comparison with the value in the ``_COMPILER_ID`` expression. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0 -.. |WARNS_OR_DOES_NOT_WARN| replace:: warns -.. include:: STANDARD_ADVICE.txt - -.. include:: DEPRECATED.txt +.. |WARNED_OR_DID_NOT_WARN| replace:: warned +.. include:: REMOVED_EPILOGUE.txt diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index ccb5222b12..a1c4ea533d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1927,7 +1927,6 @@ struct CompilerIdNode : public cmGeneratorExpressionNode static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); for (auto const& param : parameters) { - if (!compilerIdValidator.find(param)) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); @@ -1937,22 +1936,6 @@ struct CompilerIdNode : public cmGeneratorExpressionNode if (strcmp(param.c_str(), compilerId.c_str()) == 0) { return "1"; } - - if (cmsysString_strcasecmp(param.c_str(), compilerId.c_str()) == 0) { - switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) { - case cmPolicies::WARN: { - context->LG->GetCMakeInstance()->IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0044), - context->Backtrace); - CM_FALLTHROUGH; - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - break; - } - } } return "0"; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index f39d24a1f8..3eb27793eb 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -135,7 +135,7 @@ class cmMakefile; 3, 0, 0, NEW) \ SELECT(POLICY, CMP0044, \ "Case sensitive _COMPILER_ID generator expressions.", 3, 0, 0, \ - WARN) \ + NEW) \ SELECT(POLICY, CMP0045, \ "Error on non-existent target in get_target_property.", 3, 0, 0, \ WARN) \ diff --git a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt index 309a8cc1ef..4118042762 100644 --- a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt @@ -7,13 +7,8 @@ if (lc_test STREQUAL CMAKE_C_COMPILER_ID) endif() endif() -if (CMP0044_TYPE) - cmake_policy(SET CMP0044 ${CMP0044_TYPE}) -endif() - -add_library(cmp0044-check-${CMP0044_TYPE} cmp0044-check.cpp) -target_compile_definitions(cmp0044-check-${CMP0044_TYPE} +add_library(cmp0044-check cmp0044-check.cpp) +target_compile_definitions(cmp0044-check PRIVATE Result=$ - Type_Is_${CMP0044_TYPE} ) diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp index 2812b0d6f6..ad6add9f3f 100644 --- a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp +++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp @@ -1,24 +1,5 @@ - -#ifdef Type_Is_ -# if !Result -# error Result should be 1 in WARN mode -# endif -#endif - -#ifdef Type_Is_NEW -# if Result -# error Result should be 0 in NEW mode -# endif -#endif - -#ifdef Type_Is_OLD -# if !Result -# error Result should be 1 in OLD mode -# endif -#endif - -#if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW) -# error No expected definition present +#if Result +# error Result should be 0 #endif void foo(void) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 708cfc80b1..4d73bf94e1 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -438,11 +438,7 @@ add_test(echo-old-style echo "\$") set_property(TEST echo-old-style PROPERTY PASS_REGULAR_EXPRESSION "^\\$\n$") -add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-WARN) -set(CMP0044_TYPE NEW) -add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW) -set(CMP0044_TYPE OLD) -add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD) +add_subdirectory(CMP0044) if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") add_library(objlib OBJECT objlib1.c objlib2.c) @@ -504,5 +500,3 @@ if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[; DEPENDS execobjs ) endif() - -cmake_policy(VERSION 2.8.12) # old enough to not set CMP0044 diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt deleted file mode 100644 index 074cba089b..0000000000 --- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt +++ /dev/null @@ -1,7 +0,0 @@ -CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\): - Policy CMP0044 is not set: Case sensitive _COMPILER_ID generator - expressions. Run "cmake --help-policy CMP0044" for policy details. Use - the cmake_policy command to set the policy and suppress this warning. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake deleted file mode 100644 index dfa23e09e8..0000000000 --- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake +++ /dev/null @@ -1,17 +0,0 @@ - -enable_language(C) - -string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test) -if (lc_test STREQUAL CMAKE_C_COMPILER_ID) - string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test) - if (lc_test STREQUAL CMAKE_C_COMPILER_ID) - message(SEND_ERROR "Try harder.") - endif() -endif() - -add_library(cmp0044-check empty.c) -target_compile_definitions(cmp0044-check - PRIVATE - Result=$ - Type_Is_${CMP0044_TYPE} -) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt index e82802852f..bf2ef1506e 100644 --- a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -1,6 +1,3 @@ cmake_minimum_required(VERSION 3.10) -if(RunCMake_TEST STREQUAL "CMP0044-WARN") - cmake_policy(VERSION 2.8.12) # old enough to not set CMP0044 -endif() project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 8ba70aab3d..985d91b050 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -13,7 +13,6 @@ run_cmake(BadTargetTypeInterface) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) run_cmake(BadSHELL_PATH) -run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) run_cmake(NonValidTarget-Fortran_COMPILER_ID) diff --git a/Tests/RunCMake/PolicyScope/CMakeLists.txt b/Tests/RunCMake/PolicyScope/CMakeLists.txt index 667561ea79..30c0273a61 100644 --- a/Tests/RunCMake/PolicyScope/CMakeLists.txt +++ b/Tests/RunCMake/PolicyScope/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake index da608b3729..9244d0d327 100644 --- a/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake +++ b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake @@ -1,7 +1,4 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) run_cmake(NotClosed) run_cmake(NotOpened) -run_cmake(parent-dir-generate-time) -run_cmake(dir-in-macro-generate-time) diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt deleted file mode 100644 index d223f42a85..0000000000 --- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Warning \(dev\) at dir1/CMakeLists.txt:5 \(target_compile_definitions\): - Policy CMP0044 is not set: Case sensitive _COMPILER_ID generator - expressions. Run "cmake --help-policy CMP0044" for policy details. Use - the cmake_policy command to set the policy and suppress this warning. -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake deleted file mode 100644 index 04a7c2c7f9..0000000000 --- a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -include(dir-in-macro-include.cmake) diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake deleted file mode 100644 index fd326f12c3..0000000000 --- a/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -enable_language(CXX) - -# This does not affect dir1 despite being set before the add_subdirectory. -cmake_policy(SET CMP0044 NEW) -add_subdirectory(dir1) diff --git a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt deleted file mode 100644 index 66ff016f91..0000000000 --- a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ - - -add_library(foo STATIC foo.cpp) -string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id) -target_compile_definitions(foo PRIVATE Foo=$) diff --git a/Tests/RunCMake/PolicyScope/dir1/foo.cpp b/Tests/RunCMake/PolicyScope/dir1/foo.cpp deleted file mode 100644 index 766b7751bf..0000000000 --- a/Tests/RunCMake/PolicyScope/dir1/foo.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake b/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake deleted file mode 100644 index a0842f7b28..0000000000 --- a/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -enable_language(CXX) - -add_subdirectory(dir1) - -# This affects dir1 despite being set after the add_subdirectory. -cmake_policy(SET CMP0044 NEW)