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 f1fa6eb9c12d28f0d5e6afa23e012856238cfc6b (commit) via aedba1fa998a01fb483062fd393c10145219e7c4 (commit) from 5b47c32a9d7a67fadd904a4f41c4838eb79a04c2 (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=f1fa6eb9c12d28f0d5e6afa23e012856238cfc6b commit f1fa6eb9c12d28f0d5e6afa23e012856238cfc6b Merge: 5b47c32 aedba1f Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Jan 10 12:44:57 2015 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Sat Jan 10 12:44:57 2015 -0500 Merge topic 'Apple-compiler-selection' into next aedba1fa Apple: Prefer the compiler reported by Xcode to that in path. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aedba1fa998a01fb483062fd393c10145219e7c4 commit aedba1fa998a01fb483062fd393c10145219e7c4 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Jan 3 17:36:34 2015 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Jan 10 18:44:35 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 if it is found in /usr/bin. We can't simply query xcrun first and use the regular search as a fallback, because compilers in the PATH in /usr/local for example should be preferred if present. diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index f509ef3..01e91f2 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -41,8 +41,39 @@ 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_HOST_APPLE) + if(CMAKE_HOST_APPLE + AND (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND" + OR CMAKE_${lang}_COMPILER MATCHES "^/usr/bin")) foreach(comp ${CMAKE_${lang}_COMPILER_LIST}) execute_process(COMMAND xcrun --find ${comp} OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE @@ -53,37 +84,6 @@ macro(_cmake_find_compiler lang) 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 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits