You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2016/06/18 00:36:09 UTC

incubator-kudu git commit: build: squelch symbol visibility warnings seen with cmake 3.5

Repository: incubator-kudu
Updated Branches:
  refs/heads/master 1a97c42c6 -> bd549e137


build: squelch symbol visibility warnings seen with cmake 3.5

When building with cmake 3.5, these ugly warnings are emitted:

  CMake Deprecation Warning at /usr/share/cmake-3.5/Modules/GenerateExportHeader.cmake:383 (message):
    The add_compiler_export_flags function is obsolete.  Use the
    CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties
    instead.
  Call Stack (most recent call first):
    CMakeLists.txt:528 (add_compiler_export_flags)
    src/kudu/client/CMakeLists.txt:78 (ADD_EXPORTABLE_LIBRARY)

This patch replaces add_compiler_export_flags() with modifications to those
new target variables. Unfortunately, it doesn't work in cmake 3.2, so we
need to keep both approaches for the time being.

Change-Id: I10711b0a314d74fc24748801947ae7ebcc6748b4
Reviewed-on: http://gerrit.cloudera.org:8080/3405
Reviewed-by: Dan Burkert <da...@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/bd549e13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/bd549e13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/bd549e13

Branch: refs/heads/master
Commit: bd549e13743a51013585ba8446265bada5b56ed6
Parents: 1a97c42
Author: Adar Dembo <ad...@cloudera.com>
Authored: Fri Jun 17 17:05:08 2016 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Sat Jun 18 00:33:55 2016 +0000

----------------------------------------------------------------------
 CMakeLists.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/bd549e13/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f89b169..a23d8d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -450,6 +450,15 @@ include_directories(src)
 # For generate_export_header() and add_compiler_export_flags().
 include(GenerateExportHeader)
 
+# Honor visibility properties for all target types. See
+# "cmake --help-policy CMP0063" for details.
+#
+# This policy was only added to cmake in version 3.3, so until the cmake in
+# thirdparty is updated, we must check if the policy exists before setting it.
+if(POLICY CMP0063)
+  cmake_policy(SET CMP0063 NEW)
+endif()
+
 # add_library() wrapper that adds a second variant of the library for use in the
 # exported Kudu C++ client. This variant is suffixed with "_exported" and is
 # compiled with special visibility flags to hide all symbols except those that
@@ -525,7 +534,16 @@ function(ADD_EXPORTABLE_LIBRARY LIB_NAME)
   # - default for classes annotated with KUDU_EXPORT.
   # - hidden for classes annotated with KUDU_NO_EXPORT.
   # - hidden for everything else.
+if(POLICY CMP0063)
+  set_target_properties(${EXPORTED_LIB_NAME}
+    PROPERTIES C_VISIBILITY_PRESET hidden)
+  set_target_properties(${EXPORTED_LIB_NAME}
+    PROPERTIES CXX_VISIBILITY_PRESET hidden)
+  set_target_properties(${EXPORTED_LIB_NAME}
+    PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
+else()
   add_compiler_export_flags(EXPORTED_FLAGS)
+endif()
 
   # Exported variants are either static archives that will be linked to a shared
   # object, or shared objects. Either way, -fPIC is needed.