Repository: parquet-cpp Updated Branches: refs/heads/master 7c90ae7bd -> 5c02c7583
PARQUET-1052: [C++] add_compiler_export_flags() throws warning with CMake >= 3.3 Author: Deepak Majeti <[email protected]> Closes #368 from majetideepak/PARQUET-1052 and squashes the following commits: b7b34d8 [Deepak Majeti] use VISIBILITY_INLINES_HIDDEN and CXX_VISIBILITY_PRESET Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/5c02c758 Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/5c02c758 Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/5c02c758 Branch: refs/heads/master Commit: 5c02c7583be87b1a747667219c3d180164ad98ba Parents: 7c90ae7 Author: Deepak Majeti <[email protected]> Authored: Sun Jul 9 12:25:38 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Sun Jul 9 12:25:38 2017 -0400 ---------------------------------------------------------------------- CMakeLists.txt | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/5c02c758/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0627b00..5db2a54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,15 +428,6 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang") endif() ############################################################ -# Visibility -############################################################ -# For generate_export_header() and add_compiler_export_flags(). -include(GenerateExportHeader) - -# Sets -fvisibility=hidden for gcc -add_compiler_export_flags() - -############################################################ # "make lint" target ############################################################ if (UNIX) @@ -662,6 +653,36 @@ ADD_LIB(parquet LIB_RPATH_ORIGIN ${PARQUET_RPATH_ORIGIN} ) +############################################################ +# Visibility +############################################################ +# For generate_export_header() and add_compiler_export_flags(). +include(GenerateExportHeader) + +# Adapted from Apache Kudu: https://github.com/apache/kudu/commit/bd549e13743a51013585 +# 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() + +if (PARQUET_BUILD_SHARED) + if (POLICY CMP0063) + set_target_properties(parquet_shared + PROPERTIES C_VISIBILITY_PRESET hidden) + set_target_properties(parquet_shared + PROPERTIES CXX_VISIBILITY_PRESET hidden) + set_target_properties(parquet_shared + PROPERTIES VISIBILITY_INLINES_HIDDEN 1) + else() + # Sets -fvisibility=hidden for gcc + add_compiler_export_flags() + endif() +endif() + add_subdirectory(src/parquet) add_subdirectory(src/parquet/api) add_subdirectory(src/parquet/arrow)
