[Cmake-commits] [cmake-commits] king committed Darwin-GNU-C.cmake NONE 1.1 Darwin-GNU-CXX.cmake NONE 1.1 Darwin-GNU.cmake NONE 1.1 Darwin.cmake 1.60 1.61

cmake-commits at cmake.org cmake-commits at cmake.org
Sat Sep 19 10:14:34 EDT 2009


Update of /cvsroot/CMake/CMake/Modules/Platform
In directory public:/mounts/ram/cvs-serv14967/Modules/Platform

Modified Files:
	Darwin.cmake 
Added Files:
	Darwin-GNU-C.cmake Darwin-GNU-CXX.cmake Darwin-GNU.cmake 
Log Message:
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.


--- NEW FILE: Darwin-GNU.cmake ---
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()

Index: Darwin.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/Platform/Darwin.cmake,v
retrieving revision 1.60
retrieving revision 1.61
diff -C 2 -d -r1.60 -r1.61
*** Darwin.cmake	18 Sep 2009 18:22:20 -0000	1.60
--- Darwin.cmake	19 Sep 2009 14:14:31 -0000	1.61
***************
*** 183,200 ****
  ENDIF(XCODE)
  
- IF(NOT CMAKE_OSX_GCC_SUPPORT_ISYSROOT)
-   IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
-     EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} "--version"
-       OUTPUT_VARIABLE GCC_VERSION)
-   ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
-   STRING(REGEX REPLACE "^[^ ]+[ ][^ ]+[ ]([^ ]+).*$" "\\1"
-          gcc_version_tmp "${GCC_VERSION}")
-   IF(${gcc_version_tmp} VERSION_GREATER 3.9)
-     SET(CMAKE_OSX_GCC_SUPPORT_ISYSROOT TRUE CACHE INTERNAL "GCC supports isysroot")
-   ELSE(${gcc_version_tmp} VERSION_GREATER 3.9)
-     SET(CMAKE_OSX_GCC_SUPPORT_ISYSROOT FALSE CACHE INTERNAL "GCC supports isysroot")
-   ENDIF(${gcc_version_tmp} VERSION_GREATER 3.9)
- ENDIF(NOT CMAKE_OSX_GCC_SUPPORT_ISYSROOT)
- 
  # Need to list dependent shared libraries on link line.  When building
  # with -isysroot (for universal binaries), the linker always looks for
--- 183,186 ----

--- NEW FILE: Darwin-GNU-C.cmake ---
include(Platform/Darwin-GNU)
cmake_gnu_has_isysroot(C)

--- NEW FILE: Darwin-GNU-CXX.cmake ---
include(Platform/Darwin-GNU)
cmake_gnu_has_isysroot(CXX)



More information about the Cmake-commits mailing list