CMP0025: Remove support for OLD behavior

This commit is contained in:
Brad King 2024-11-22 16:50:57 -05:00
parent 65b45de1dd
commit 796cf2d8eb
7 changed files with 9 additions and 46 deletions

View File

@ -1,6 +1,9 @@
CMP0025
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Compiler id for Apple Clang is now ``AppleClang``.
CMake 3.0 and above recognize that Apple Clang is a different compiler
@ -19,11 +22,9 @@ The ``OLD`` behavior for this policy is to use compiler id ``Clang``. The
``NEW`` behavior for this policy is to use compiler id ``AppleClang``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
.. include:: STANDARD_ADVICE.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
.. include:: REMOVED_EPILOGUE.txt
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0025 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
.. include:: DEPRECATED.txt
variable to control the warning in CMake versions before 4.0.

View File

@ -6,8 +6,8 @@ has not been set explicitly by :command:`cmake_policy` or implicitly
by :command:`cmake_minimum_required`. This is meaningful
only for the policies that do not warn by default:
* ``CMAKE_POLICY_WARNING_CMP0025`` controls the warning for
policy :policy:`CMP0025`.
* ``CMAKE_POLICY_WARNING_CMP0025`` controlled the warning for
policy :policy:`CMP0025` in CMake versions before 4.0.
* ``CMAKE_POLICY_WARNING_CMP0047`` controls the warning for
policy :policy:`CMP0047`.
* ``CMAKE_POLICY_WARNING_CMP0056`` controls the warning for

View File

@ -1,11 +1,6 @@
include(Compiler/Clang)
__compiler_clang(C)
cmake_policy(GET CMP0025 appleClangPolicy)
if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
return()
endif()
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")

View File

@ -15,11 +15,6 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
cmake_policy(GET CMP0025 appleClangPolicy)
if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
return()
endif()
if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")

View File

@ -1011,31 +1011,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
std::string compilerIdVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID");
std::string const compilerId = mf->GetSafeDefinition(compilerIdVar);
if (compilerId == "AppleClang") {
switch (mf->GetPolicyStatus(cmPolicies::CMP0025)) {
case cmPolicies::WARN:
if (!this->CMakeInstance->GetIsInTryCompile() &&
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) {
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n"
"Converting " << lang <<
R"( compiler id "AppleClang" to "Clang" for compatibility.)"
;
/* clang-format on */
mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to convert AppleClang to Clang.
mf->AddDefinition(compilerIdVar, "Clang");
break;
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
break;
}
}
if (compilerId == "QCC") {
switch (mf->GetPolicyStatus(cmPolicies::CMP0047)) {
case cmPolicies::WARN:

View File

@ -86,7 +86,7 @@ class cmMakefile;
8, 12, NEW) \
SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, NEW) \
SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \
3, 0, 0, WARN) \
3, 0, 0, NEW) \
SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \
0, 0, WARN) \
SELECT(POLICY, CMP0027, \

View File

@ -107,9 +107,6 @@ function(run_cmake test)
if(NOT DEFINED RunCMake_TEST_OPTIONS)
set(RunCMake_TEST_OPTIONS "")
endif()
if(APPLE)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
endif()
if(RunCMake_TEST_LCC AND NOT RunCMake_TEST_NO_CMP0129)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW)
endif()