summaryrefslogtreecommitdiffstats
path: root/Modules/GenerateExportHeader.cmake
diff options
context:
space:
mode:
authorscivision <scivision@users.noreply.github.com>2023-03-10 03:08:45 (GMT)
committerscivision <scivision@users.noreply.github.com>2023-03-13 14:36:09 (GMT)
commit03c6ebf2b53956d9d8d035f9bf67bb73caca65f3 (patch)
tree339c721aef3fa301ecd50436522f4e239edc8c76 /Modules/GenerateExportHeader.cmake
parent7d43bcb4db2b26d9f9f8d828198252a44b5560a0 (diff)
downloadCMake-03c6ebf2b53956d9d8d035f9bf67bb73caca65f3.zip
CMake-03c6ebf2b53956d9d8d035f9bf67bb73caca65f3.tar.gz
CMake-03c6ebf2b53956d9d8d035f9bf67bb73caca65f3.tar.bz2
Modules:Check,GenerateExportHeader: include only what's needed
GenerateExportHeader had a hidden state requirement that other modules were included first. Considering include_guard, Modules should include all they actually use.
Diffstat (limited to 'Modules/GenerateExportHeader.cmake')
-rw-r--r--Modules/GenerateExportHeader.cmake18
1 files changed, 9 insertions, 9 deletions
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index ea8616a..01a6e4f 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -198,19 +198,19 @@ that will be populated with the ``CXX_FLAGS`` required to enable visibility
support for the compiler/architecture in use.
#]=======================================================================]
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
+include(CheckCompilerFlag)
+include(CheckSourceCompiles)
# TODO: Install this macro separately?
macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT)
- check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; }
+ check_source_compiles(CXX "${_ATTRIBUTE} int somefunc() { return 0; }
int main() { return somefunc();}" ${_RESULT}
)
endmacro()
# TODO: Install this macro separately?
macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT)
- check_c_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; }
+ check_source_compiles(C "${_ATTRIBUTE} int somefunc() { return 0; }
int main() { return somefunc();}" ${_RESULT}
)
endmacro()
@@ -226,7 +226,7 @@ macro(_test_compiler_hidden_visibility)
endif()
# Exclude XL here because it misinterprets -fvisibility=hidden even though
- # the check_cxx_compiler_flag passes
+ # the check_compiler_flag passes
if(NOT GCC_TOO_OLD
AND NOT _INTEL_TOO_OLD
AND NOT WIN32
@@ -235,12 +235,12 @@ macro(_test_compiler_hidden_visibility)
AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(PGI|NVHPC)$"
AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
if (CMAKE_CXX_COMPILER_LOADED)
- check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
- check_cxx_compiler_flag(-fvisibility-inlines-hidden
+ check_compiler_flag(CXX -fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_compiler_flag(CXX -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
+ check_compiler_flag(C -fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_compiler_flag(C -fvisibility-inlines-hidden
COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
endif()
endif()