CMP0063: Remove support for OLD behavior
This commit is contained in:
parent
36fffb673a
commit
ac1a9cb160
@ -1,6 +1,9 @@
|
||||
CMP0063
|
||||
-------
|
||||
|
||||
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||
.. include:: REMOVED_PROLOGUE.txt
|
||||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
Honor visibility properties for all target types.
|
||||
@ -23,7 +26,5 @@ The ``NEW`` behavior for this policy is to honor the visibility properties
|
||||
for all target types.
|
||||
|
||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
|
||||
.. |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
|
||||
|
@ -5,8 +5,8 @@ Value for symbol visibility compile flags
|
||||
|
||||
The ``<LANG>_VISIBILITY_PRESET`` property determines the value passed in a
|
||||
visibility related compile option, such as ``-fvisibility=`` for ``<LANG>``.
|
||||
This property affects compilation in sources of all types of targets
|
||||
(subject to policy :policy:`CMP0063`).
|
||||
This property affects compilation in sources of all types of targets.
|
||||
See policy :policy:`CMP0063`.
|
||||
|
||||
This property is initialized by the value of the
|
||||
:variable:`CMAKE_<LANG>_VISIBILITY_PRESET` variable if it is set when a
|
||||
|
@ -6,7 +6,7 @@ Whether to add a compile flag to hide symbols of inline functions
|
||||
The ``VISIBILITY_INLINES_HIDDEN`` property determines whether a flag for
|
||||
hiding symbols for inline functions, such as ``-fvisibility-inlines-hidden``,
|
||||
should be used when invoking the compiler. This property affects compilation
|
||||
in sources of all types of targets (subject to policy :policy:`CMP0063`).
|
||||
in sources of all types of targets. See policy :policy:`CMP0063`.
|
||||
|
||||
This property is initialized by
|
||||
the value of the :variable:`CMAKE_VISIBILITY_INLINES_HIDDEN` variable if it
|
||||
|
@ -2426,8 +2426,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
|
||||
static void AddVisibilityCompileOption(std::string& flags,
|
||||
cmGeneratorTarget const* target,
|
||||
cmLocalGenerator* lg,
|
||||
const std::string& lang,
|
||||
std::string* warnCMP0063)
|
||||
const std::string& lang)
|
||||
{
|
||||
std::string compileOption = "CMAKE_" + lang + "_COMPILE_OPTIONS_VISIBILITY";
|
||||
cmValue opt = lg->GetMakefile()->GetDefinition(compileOption);
|
||||
@ -2440,10 +2439,6 @@ static void AddVisibilityCompileOption(std::string& flags,
|
||||
if (!prop) {
|
||||
return;
|
||||
}
|
||||
if (warnCMP0063) {
|
||||
*warnCMP0063 += " " + flagDefine + "\n";
|
||||
return;
|
||||
}
|
||||
if ((*prop != "hidden") && (*prop != "default") && (*prop != "protected") &&
|
||||
(*prop != "internal")) {
|
||||
std::ostringstream e;
|
||||
@ -2461,7 +2456,6 @@ static void AddVisibilityCompileOption(std::string& flags,
|
||||
static void AddInlineVisibilityCompileOption(std::string& flags,
|
||||
cmGeneratorTarget const* target,
|
||||
cmLocalGenerator* lg,
|
||||
std::string* warnCMP0063,
|
||||
const std::string& lang)
|
||||
{
|
||||
std::string compileOption =
|
||||
@ -2475,10 +2469,6 @@ static void AddInlineVisibilityCompileOption(std::string& flags,
|
||||
if (!prop) {
|
||||
return;
|
||||
}
|
||||
if (warnCMP0063) {
|
||||
*warnCMP0063 += " VISIBILITY_INLINES_HIDDEN\n";
|
||||
return;
|
||||
}
|
||||
lg->AppendFlags(flags, *opt);
|
||||
}
|
||||
|
||||
@ -2489,41 +2479,10 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
|
||||
return;
|
||||
}
|
||||
|
||||
std::string warnCMP0063;
|
||||
std::string* pWarnCMP0063 = nullptr;
|
||||
if (target->GetType() != cmStateEnums::SHARED_LIBRARY &&
|
||||
target->GetType() != cmStateEnums::MODULE_LIBRARY &&
|
||||
!target->IsExecutableWithExports()) {
|
||||
switch (target->GetPolicyStatusCMP0063()) {
|
||||
case cmPolicies::OLD:
|
||||
return;
|
||||
case cmPolicies::WARN:
|
||||
pWarnCMP0063 = &warnCMP0063;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063);
|
||||
AddVisibilityCompileOption(flags, target, this, lang);
|
||||
|
||||
if (lang == "CXX" || lang == "OBJCXX") {
|
||||
AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063, lang);
|
||||
}
|
||||
|
||||
if (!warnCMP0063.empty() && this->WarnCMP0063.insert(target).second) {
|
||||
std::ostringstream w;
|
||||
/* clang-format off */
|
||||
w <<
|
||||
cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n"
|
||||
"Target \"" << target->GetName() << "\" of "
|
||||
"type \"" << cmState::GetTargetTypeName(target->GetType()) << "\" "
|
||||
"has the following visibility properties set for " << lang << ":\n" <<
|
||||
warnCMP0063 <<
|
||||
"For compatibility CMake is not honoring them for this target.";
|
||||
/* clang-format on */
|
||||
target->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING, w.str(), target->GetBacktrace());
|
||||
AddInlineVisibilityCompileOption(flags, target, this, lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,6 @@ protected:
|
||||
GeneratorTargetMap GeneratorTargetSearchIndex;
|
||||
GeneratorTargetVector GeneratorTargets;
|
||||
|
||||
std::set<cmGeneratorTarget const*> WarnCMP0063;
|
||||
GeneratorTargetMap ImportedGeneratorTargets;
|
||||
GeneratorTargetVector OwnedImportedGeneratorTargets;
|
||||
std::map<std::string, std::string> AliasTargets;
|
||||
|
@ -184,7 +184,7 @@ class cmMakefile;
|
||||
SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
|
||||
NEW) \
|
||||
SELECT(POLICY, CMP0063, \
|
||||
"Honor visibility properties for all target types.", 3, 3, 0, WARN) \
|
||||
"Honor visibility properties for all target types.", 3, 3, 0, NEW) \
|
||||
SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, WARN) \
|
||||
SELECT(POLICY, CMP0065, \
|
||||
"Do not add flags to export symbols from executables without " \
|
||||
|
@ -1,4 +1,3 @@
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake would warn even if toolchain does not really have these flags.
|
||||
|
@ -1,18 +0,0 @@
|
||||
^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
+
|
||||
CMake Deprecation Warning at CMP0063-OLD.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0063 will be removed from a future version
|
||||
of CMake.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
@ -1,8 +0,0 @@
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake would warn even if toolchain does not really have these flags.
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
||||
|
||||
include(CMP0063-Common.cmake)
|
@ -1,23 +0,0 @@
|
||||
^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0063-WARN-exe.cmake:[0-9]+ \(add_executable\):
|
||||
Policy CMP0063 is not set: Honor visibility properties for all target
|
||||
types. Run "cmake --help-policy CMP0063" for policy details. Use the
|
||||
cmake_policy command to set the policy and suppress this warning.
|
||||
|
||||
Target "myexe" of type "EXECUTABLE" has the following visibility properties
|
||||
set for CXX:
|
||||
|
||||
CXX_VISIBILITY_PRESET
|
||||
VISIBILITY_INLINES_HIDDEN
|
||||
|
||||
For compatibility CMake is not honoring them for this target.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -1,11 +0,0 @@
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake warns even if toolchain does not really have these flags.
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
||||
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_executable(myexe lib.cpp)
|
@ -1,7 +0,0 @@
|
||||
^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.$
|
@ -1,8 +0,0 @@
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake does not warn even if toolchain really does have these flags.
|
||||
unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
|
||||
unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY)
|
||||
|
||||
include(CMP0063-Common.cmake)
|
@ -1,23 +0,0 @@
|
||||
^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0063-WARN-obj.cmake:[0-9]+ \(add_library\):
|
||||
Policy CMP0063 is not set: Honor visibility properties for all target
|
||||
types. Run "cmake --help-policy CMP0063" for policy details. Use the
|
||||
cmake_policy command to set the policy and suppress this warning.
|
||||
|
||||
Target "myobject" of type "OBJECT_LIBRARY" has the following visibility
|
||||
properties set for CXX:
|
||||
|
||||
CXX_VISIBILITY_PRESET
|
||||
VISIBILITY_INLINES_HIDDEN
|
||||
|
||||
For compatibility CMake is not honoring them for this target.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -1,11 +0,0 @@
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake warns even if toolchain does not really have these flags.
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
||||
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_library(myobject OBJECT lib.cpp)
|
@ -1,23 +0,0 @@
|
||||
^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
+
|
||||
CMake Warning \(dev\) at CMP0063-WARN-sta.cmake:[0-9]+ \(add_library\):
|
||||
Policy CMP0063 is not set: Honor visibility properties for all target
|
||||
types. Run "cmake --help-policy CMP0063" for policy details. Use the
|
||||
cmake_policy command to set the policy and suppress this warning.
|
||||
|
||||
Target "mystatic" of type "STATIC_LIBRARY" has the following visibility
|
||||
properties set for CXX:
|
||||
|
||||
CXX_VISIBILITY_PRESET
|
||||
VISIBILITY_INLINES_HIDDEN
|
||||
|
||||
For compatibility CMake is not honoring them for this target.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -1,11 +0,0 @@
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
# Ensure CMake warns even if toolchain does not really have these flags.
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
||||
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_library(mystatic STATIC lib.cpp)
|
@ -1,6 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
if(RunCMake_TEST MATCHES "CMP0063-(OLD|WARN)")
|
||||
cmake_policy(VERSION 3.2) # old enough to not set CMP0063
|
||||
endif()
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
|
@ -1,10 +1,4 @@
|
||||
include(RunCMake)
|
||||
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
|
||||
|
||||
run_cmake(PropertyTypo)
|
||||
run_cmake(CMP0063-OLD)
|
||||
run_cmake(CMP0063-WARN-exe)
|
||||
run_cmake(CMP0063-WARN-obj)
|
||||
run_cmake(CMP0063-WARN-sta)
|
||||
run_cmake(CMP0063-WARN-no)
|
||||
run_cmake(CMP0063-NEW)
|
||||
|
@ -1,6 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
|
||||
project(Visibility)
|
||||
|
||||
add_library(hidden1 SHARED hidden.c)
|
||||
|
Loading…
Reference in New Issue
Block a user