summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Darwin-GNU.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-19 14:14:31 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-19 14:14:31 (GMT)
commit180c60a86f5c44085a1a66865bfc8b9479c72e8a (patch)
tree33e7fc0647387c8a73a49e9a7e40c6d672fd5fee /Modules/Platform/Darwin-GNU.cmake
parent196d9a54aa7083c2d063147ac431c7efd11f393d (diff)
downloadCMake-180c60a86f5c44085a1a66865bfc8b9479c72e8a.zip
CMake-180c60a86f5c44085a1a66865bfc8b9479c72e8a.tar.gz
CMake-180c60a86f5c44085a1a66865bfc8b9479c72e8a.tar.bz2
Fix check for -isysroot on OS X
Previously we checked for this flag by parsing the version number of GCC out of 'gcc --version', but this is not reliable because the format can vary greatly. Now we run 'gcc -v --help' and look for '-isysroot' in the list of options. We also now store the result on a per-language basis in the per-compiler info file "CMake<LANG>Compiler.cmake". This is necessary to make it accessible from try-compile projects so that they generate correctly.
Diffstat (limited to 'Modules/Platform/Darwin-GNU.cmake')
-rw-r--r--Modules/Platform/Darwin-GNU.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
new file mode 100644
index 0000000..8bbad88
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -0,0 +1,18 @@
+macro(cmake_gnu_has_isysroot lang)
+ if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x")
+ set(_doc "${lang} compiler has -isysroot")
+ message(STATUS "Checking whether ${_doc}")
+ execute_process(
+ COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
+ OUTPUT_VARIABLE _gcc_help
+ ERROR_VARIABLE _gcc_help
+ )
+ if("${_gcc_help}" MATCHES "isysroot")
+ message(STATUS "Checking whether ${_doc} - yes")
+ set(CMAKE_${lang}_HAS_ISYSROOT 1)
+ else()
+ message(STATUS "Checking whether ${_doc} - no")
+ set(CMAKE_${lang}_HAS_ISYSROOT 0)
+ endif()
+ endif()
+endmacro()