CMP0044: Remove support for OLD behavior

This commit is contained in:
Brad King 2024-12-04 14:12:55 -05:00
parent ed99370f63
commit 9094eaa778
20 changed files with 12 additions and 121 deletions

View File

@ -1,6 +1,9 @@
CMP0044
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Case sensitive ``<LANG>_COMPILER_ID`` generator expressions
CMake 2.8.12 introduced the ``<LANG>_COMPILER_ID``
@ -15,7 +18,5 @@ for this policy is to perform a case-sensitive comparison with the value in
the ``<LANG>_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

View File

@ -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";
}

View File

@ -135,7 +135,7 @@ class cmMakefile;
3, 0, 0, NEW) \
SELECT(POLICY, CMP0044, \
"Case sensitive <LANG>_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) \

View File

@ -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=$<C_COMPILER_ID:${lc_test}>
Type_Is_${CMP0044_TYPE}
)

View File

@ -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)

View File

@ -438,11 +438,7 @@ add_test(echo-old-style echo "\$<CONFIGURATION>")
set_property(TEST echo-old-style PROPERTY
PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\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

View File

@ -1,7 +0,0 @@
CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\):
Policy CMP0044 is not set: Case sensitive <LANG>_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.

View File

@ -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=$<C_COMPILER_ID:${lc_test}>
Type_Is_${CMP0044_TYPE}
)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1,5 +0,0 @@
CMake Warning \(dev\) at dir1/CMakeLists.txt:5 \(target_compile_definitions\):
Policy CMP0044 is not set: Case sensitive <LANG>_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.

View File

@ -1,2 +0,0 @@
include(dir-in-macro-include.cmake)

View File

@ -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)

View File

@ -1,5 +0,0 @@
add_library(foo STATIC foo.cpp)
string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id)
target_compile_definitions(foo PRIVATE Foo=$<CXX_COMPILER_ID:invalid,${compiler_id}>)

View File

@ -1,5 +0,0 @@
int main()
{
return 0;
}

View File

@ -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)