kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #20153
[PATCH] Use CMake provided tests for -fvisibility
Hi,
CMake provides a readymade test for the GCC/CLang -fvisibility= flag. This
removes our own test and uses the result from CMake.
I've left the test for "NOT APPLE" in place -- is there a particular reason
why we do that?
Simon
---
CMakeLists.txt | 16 ++++++++--------
CMakeModules/PerformFeatureChecks.cmake | 2 --
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e44994..fdff8a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,14 +164,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" )
- if( GXX_HAS_VISIBILITY_FLAG AND NOT APPLE )
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
- endif()
-
- if( GXX_HAS_VISIBILITY_INLINES_FLAG AND NOT APPLE )
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
- endif()
-
find_package( OpenMP QUIET )
if( OPENMP_FOUND )
@@ -279,6 +271,14 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY AND NOT APPLE )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden" )
+endif()
+
+if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN AND NOT APPLE )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" )
+endif()
+
if( KICAD_KEEPCASE )
add_definitions( -DKICAD_KEEPCASE )
endif()
diff --git a/CMakeModules/PerformFeatureChecks.cmake b/CMakeModules/PerformFeatureChecks.cmake
index 0240046..531ab27 100644
--- a/CMakeModules/PerformFeatureChecks.cmake
+++ b/CMakeModules/PerformFeatureChecks.cmake
@@ -47,8 +47,6 @@ macro( perform_feature_checks )
include( CheckCXXSourceCompiles )
include( CheckCXXCompilerFlag )
- check_cxx_compiler_flag( -fvisibility=hidden GXX_HAS_VISIBILITY_FLAG )
- check_cxx_compiler_flag( -fvisibility-inlines-hidden GXX_HAS_VISIBILITY_INLINES_FLAG )
check_include_file( "malloc.h" HAVE_MALLOC_H )