[Cmake-commits] CMake branch, next, updated. v3.1.0-1480-g2890d2c

Stephen Kelly steveire at gmail.com
Sat Jan 3 11:44:23 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  2890d2caa2a4c95518f72371bb57fb959e97419e (commit)
       via  76532b843f467e936466e30106acb04e5e7859db (commit)
       via  472553b4c152e741cfafc11cdca48a5bfeae4206 (commit)
       via  24dfa74214bba9ac80e675e0cf7d13d72474f652 (commit)
      from  625dde5e7f890a840160408c4b494a454e61fbae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2890d2caa2a4c95518f72371bb57fb959e97419e
commit 2890d2caa2a4c95518f72371bb57fb959e97419e
Merge: 625dde5 76532b8
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 3 11:44:22 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Jan 3 11:44:22 2015 -0500

    Merge topic 'Apple-compiler-selection' into next
    
    76532b84 Apple: Prefer the compiler reported by Xcode to that in path.
    472553b4 CMake Nightly Date Stamp
    24dfa742 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76532b843f467e936466e30106acb04e5e7859db
commit 76532b843f467e936466e30106acb04e5e7859db
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 3 17:36:34 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 3 17:36:34 2015 +0100

    Apple: Prefer the compiler reported by Xcode to that in path.
    
    The compiler in the PATH on mac is a stub for a different delegate
    depending on the environment.  Rather than requiring xcode-select to
    change the used Xcode globally, users should be able to choose the
    compiler per-session.  That is possible with the DEVELOPER_DIR
    environment variable.
    
    However, the environment can change between running CMake and invoking
    the build.  In such cases, CMake prefers to record the relevant paths
    from the environment and use them when invoking the build.  That is not
    currently done for the compilers on APPLE, so the compiler used is not
    the one reported when running cmake:
    
     $ DEVELOPER_DIR=/Applications/Xcode2.app/Contents/Developer/ cc --version
     Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
     Target: x86_64-apple-darwin13.4.0
     Thread model: posix
    
     $ DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/ cc --version
     Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
     Target: x86_64-apple-darwin13.4.0
     Thread model: posix
    
    Update that now by querying Xcode for the correct compiler path before
    falling back to whatever is delegated to by the compilers in /usr/bin.

diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index 0ab3af6..f509ef3 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -41,47 +41,49 @@ macro(_cmake_find_compiler lang)
     endif()
   endif()
 
-  # Look for directories containing compilers of reference languages.
-  set(_${lang}_COMPILER_HINTS)
-  foreach(l ${_languages})
-    if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
-      get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
-      if(IS_DIRECTORY "${_hint}")
-        list(APPEND _${lang}_COMPILER_HINTS "${_hint}")
-      endif()
-      unset(_hint)
-    endif()
-  endforeach()
-
-  # Find the compiler.
-  if(_${lang}_COMPILER_HINTS)
-    # Prefer directories containing compilers of reference languages.
-    list(REMOVE_DUPLICATES _${lang}_COMPILER_HINTS)
-    find_program(CMAKE_${lang}_COMPILER
-      NAMES ${CMAKE_${lang}_COMPILER_LIST}
-      PATHS ${_${lang}_COMPILER_HINTS}
-      NO_DEFAULT_PATH
-      DOC "${lang} compiler")
-  endif()
-  find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
-  if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
-    set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
-  endif()
-  unset(_${lang}_COMPILER_HINTS)
-  unset(_languages)
-
   # Look for a make tool provided by Xcode
-  if(CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND" AND CMAKE_HOST_APPLE)
+  if(CMAKE_HOST_APPLE)
     foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
       execute_process(COMMAND xcrun --find ${comp}
         OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
         ERROR_VARIABLE _xcrun_err)
       if(_xcrun_out)
-        set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${_xcrun_out}")
+        set(CMAKE_${lang}_COMPILER "${_xcrun_out}" CACHE PATH "${lang} compiler")
         break()
       endif()
     endforeach()
   endif()
+
+  if(NOT CMAKE_${lang}_COMPILER)
+    # Look for directories containing compilers of reference languages.
+    set(_${lang}_COMPILER_HINTS)
+    foreach(l ${_languages})
+      if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
+        get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
+        if(IS_DIRECTORY "${_hint}")
+          list(APPEND _${lang}_COMPILER_HINTS "${_hint}")
+        endif()
+        unset(_hint)
+      endif()
+    endforeach()
+
+    # Find the compiler.
+    if(_${lang}_COMPILER_HINTS)
+      # Prefer directories containing compilers of reference languages.
+      list(REMOVE_DUPLICATES _${lang}_COMPILER_HINTS)
+      find_program(CMAKE_${lang}_COMPILER
+        NAMES ${CMAKE_${lang}_COMPILER_LIST}
+        PATHS ${_${lang}_COMPILER_HINTS}
+        NO_DEFAULT_PATH
+        DOC "${lang} compiler")
+    endif()
+    find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
+    if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
+      set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
+    endif()
+    unset(_${lang}_COMPILER_HINTS)
+  endif()
+  unset(_languages)
 endmacro()
 
 macro(_cmake_find_compiler_path lang)

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeDetermineCompiler.cmake |   64 ++++++++++++++++++----------------
 Source/CMakeVersion.cmake            |    2 +-
 2 files changed, 34 insertions(+), 32 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list