summaryrefslogtreecommitdiffstats
path: root/Modules/CheckSymbolExists.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2015-09-22 04:11:50 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-25 14:07:54 (GMT)
commita27bc0ccacff7bc590ace2ce941f0552d05fd14c (patch)
treeb9f4b5e0ce15408cf38aa7db19af5ac4d900c850 /Modules/CheckSymbolExists.cmake
parent7279f2939e98ae9ecfb8fda2dc82f6b0048b9316 (diff)
downloadCMake-a27bc0ccacff7bc590ace2ce941f0552d05fd14c.zip
CMake-a27bc0ccacff7bc590ace2ce941f0552d05fd14c.tar.gz
CMake-a27bc0ccacff7bc590ace2ce941f0552d05fd14c.tar.bz2
Check(Function|Library|Symbol)Exists: make it work if only C++ is enabled
Diffstat (limited to 'Modules/CheckSymbolExists.cmake')
-rw-r--r--Modules/CheckSymbolExists.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 79c5ba7..c4dff3f 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -44,10 +44,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-
-
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
- _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ if(CMAKE_C_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ else()
+ message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled")
+ endif()
endmacro()
macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)