summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-13 15:21:30 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-01-13 15:22:06 (GMT)
commitb1a9d49a691c8d2bd21790b5111f9594b89ac83d (patch)
treee26d2b6acb9ea95ff0fafa9c7c1be88e0400d8a1
parent01b43e85cfece674e26069bf55903fb7521bad38 (diff)
parent7347e2f830b75dae94535b64d3925b55b098d88b (diff)
downloadCMake-b1a9d49a691c8d2bd21790b5111f9594b89ac83d.zip
CMake-b1a9d49a691c8d2bd21790b5111f9594b89ac83d.tar.gz
CMake-b1a9d49a691c8d2bd21790b5111f9594b89ac83d.tar.bz2
Merge topic 'objc-visibility-inlines' into release-3.16
7347e2f830 ObjC: Add VISIBLITY_INLINES_HIDDEN support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4199
-rw-r--r--Modules/Compiler/AppleClang-OBJCXX.cmake2
-rw-r--r--Modules/Compiler/GNU-OBJC.cmake4
-rw-r--r--Modules/Compiler/GNU-OBJCXX.cmake6
-rw-r--r--Source/cmLocalGenerator.cxx9
4 files changed, 10 insertions, 11 deletions
diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake
index 7c6f763..2c084af 100644
--- a/Modules/Compiler/AppleClang-OBJCXX.cmake
+++ b/Modules/Compiler/AppleClang-OBJCXX.cmake
@@ -1,5 +1,7 @@
include(Compiler/Clang-OBJCXX)
+set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+
if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_OBJCXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_OBJCXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
diff --git a/Modules/Compiler/GNU-OBJC.cmake b/Modules/Compiler/GNU-OBJC.cmake
index 5fba801..fb9b0b2 100644
--- a/Modules/Compiler/GNU-OBJC.cmake
+++ b/Modules/Compiler/GNU-OBJC.cmake
@@ -1,6 +1,2 @@
include(Compiler/GNU)
__compiler_gnu(OBJC)
-
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
- set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
-endif()
diff --git a/Modules/Compiler/GNU-OBJCXX.cmake b/Modules/Compiler/GNU-OBJCXX.cmake
index 66a547e..06f0244 100644
--- a/Modules/Compiler/GNU-OBJCXX.cmake
+++ b/Modules/Compiler/GNU-OBJCXX.cmake
@@ -1,8 +1,8 @@
include(Compiler/GNU)
-__compiler_gnu(OBJC)
+__compiler_gnu(OBJCXX)
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
- set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.2)
+ set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
if(NOT CMAKE_OBJCXX_LINK_FLAGS)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1754421..be13a37 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2104,10 +2104,11 @@ static void AddVisibilityCompileOption(std::string& flags,
static void AddInlineVisibilityCompileOption(std::string& flags,
cmGeneratorTarget const* target,
cmLocalGenerator* lg,
- std::string* warnCMP0063)
+ std::string* warnCMP0063,
+ const std::string& lang)
{
std::string compileOption =
- "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN";
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN");
const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
if (!opt) {
return;
@@ -2149,8 +2150,8 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063);
- if (lang == "CXX") {
- AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063);
+ if (lang == "CXX" || lang == "OBJCXX") {
+ AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063, lang);
}
if (!warnCMP0063.empty() && this->WarnCMP0063.insert(target).second) {