diff --git a/Help/policy/CMP0063.rst b/Help/policy/CMP0063.rst index 1e1cbfaf33..1f00c20ee8 100644 --- a/Help/policy/CMP0063.rst +++ b/Help/policy/CMP0063.rst @@ -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 diff --git a/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst b/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst index 5d34e207ef..638f753a3c 100644 --- a/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst +++ b/Help/prop_tgt/LANG_VISIBILITY_PRESET.rst @@ -5,8 +5,8 @@ Value for symbol visibility compile flags The ``_VISIBILITY_PRESET`` property determines the value passed in a visibility related compile option, such as ``-fvisibility=`` for ````. -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__VISIBILITY_PRESET` variable if it is set when a diff --git a/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst b/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst index adbbc7103f..4846139eb5 100644 --- a/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst +++ b/Help/prop_tgt/VISIBILITY_INLINES_HIDDEN.rst @@ -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 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 861210c4d5..5442f395a7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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); } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3382675775..afd2da8645 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -585,7 +585,6 @@ protected: GeneratorTargetMap GeneratorTargetSearchIndex; GeneratorTargetVector GeneratorTargets; - std::set WarnCMP0063; GeneratorTargetMap ImportedGeneratorTargets; GeneratorTargetVector OwnedImportedGeneratorTargets; std::map AliasTargets; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 15d6449bca..791073afb8 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -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 " \ diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake index 9d1ee40740..48f232dbdb 100644 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake @@ -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. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt deleted file mode 100644 index 7837d23df2..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt +++ /dev/null @@ -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 value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by 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\)$ diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake deleted file mode 100644 index 8378209c97..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt deleted file mode 100644 index dc45d508d8..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt +++ /dev/null @@ -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 value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by 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. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake deleted file mode 100644 index cef1d75219..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt deleted file mode 100644 index c59fe7bac5..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no-stderr.txt +++ /dev/null @@ -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 value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by or earlier\.$ diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake deleted file mode 100644 index 2a9c9e543d..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt deleted file mode 100644 index 96bd79275d..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt +++ /dev/null @@ -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 value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by 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. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake deleted file mode 100644 index 81d1c339bd..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt deleted file mode 100644 index b945e309ea..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt +++ /dev/null @@ -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 value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by 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. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake deleted file mode 100644 index 132e076e27..0000000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake +++ /dev/null @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt index 69e023688a..bf2ef1506e 100644 --- a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt +++ b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt @@ -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) diff --git a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake index 133dbe1641..6b5541a3aa 100644 --- a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake +++ b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.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) diff --git a/Tests/Visibility/CMakeLists.txt b/Tests/Visibility/CMakeLists.txt index 66f781cd52..efbe9fc9d3 100644 --- a/Tests/Visibility/CMakeLists.txt +++ b/Tests/Visibility/CMakeLists.txt @@ -1,6 +1,4 @@ cmake_minimum_required(VERSION 3.10) -cmake_policy(SET CMP0063 NEW) - project(Visibility) add_library(hidden1 SHARED hidden.c)