MantisBT - CMake
View Issue Details
0014456CMake(No Category)public2013-10-02 17:452016-06-10 14:31
Stephen Kelly 
Kitware Robot 
normalminorhave not tried
closedmoved 
 
 
0014456: Disable the compiler test for hidden_visibility in GenerateExportHeader if possible.
It does not need to be run if CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY is DEFINED.
No tags attached.
Issue History
2013-10-02 17:45Stephen KellyNew Issue
2013-10-02 17:46Stephen KellyAssigned To => Stephen Kelly
2013-10-02 17:46Stephen KellyStatusnew => assigned
2013-10-02 17:46Stephen KellyTarget Version => CMake 3.0
2013-12-17 09:15Stephen KellyNote Added: 0034785
2013-12-17 09:15Stephen KellyTarget VersionCMake 3.0 =>
2014-04-30 10:13Theodore PapadopouloNote Added: 0035809
2014-06-22 06:32Stephen KellyAssigned ToStephen Kelly =>
2014-06-22 06:32Stephen KellyStatusassigned => backlog
2016-06-10 14:29Kitware RobotNote Added: 0042382
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0034785)
Stephen Kelly   
2013-12-17 09:15   
This will also require CMake built-in interfaces for deprecation.
(0035809)
Theodore Papadopoulo   
2014-04-30 10:13   
Actually the test _test_compiler_hidden_visibility is also a C++ test which does not work for C only projects. Turning it into a C/C++ test would be a bonus.
Something along the lines (untested though):

diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index f83f992..0037842 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -221,12 +221,20 @@ macro(_test_compiler_hidden_visibility)
       AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
       AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
       AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
- check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
- check_cxx_compiler_flag(-fvisibility-inlines-hidden
- COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
- option(USE_COMPILER_HIDDEN_VISIBILITY
- "Use HIDDEN visibility support if available." ON)
- mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
+ get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
+ if (_LANGUAGES_ MATCHES CXX)
+ check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_cxx_compiler_flag(-fvisibility-inlines-hidden
+ COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
+ else()
+ check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_c_compiler_flag(-fvisibility-inlines-hidden
+ endif()
+ if (COMPILER_HAS_HIDDEN_VISIBILITY)
+ option(USE_COMPILER_HIDDEN_VISIBILITY
+ "Use HIDDEN visibility support if available." ON)
+ mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
+ endif()
   endif()
 endmacro()
(0042382)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.