[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-812-g698031a

Brad King brad.king at kitware.com
Tue Mar 11 09:01:52 EDT 2014


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  698031a5a9daacecd984a3a25522c5c20324b75b (commit)
       via  8c9bfac3848bc2c53c034b03cf89a3aaa8f3a248 (commit)
       via  6852fb8034d30d14498dc874378881696a6ada23 (commit)
      from  efb4d8594d0afafdbe5f6d1a23bfeb380cf5edbd (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=698031a5a9daacecd984a3a25522c5c20324b75b
commit 698031a5a9daacecd984a3a25522c5c20324b75b
Merge: efb4d85 8c9bfac
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 11 09:01:51 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 11 09:01:51 2014 -0400

    Merge topic 'fix-xcode-compiler-force' into next
    
    8c9bfac3 Xcode: Convert forced CMAKE_<LANG>_COMPILER to full path if possible
    6852fb80 CMakeDetermine*Compiler: Factor out search for compiler in PATH


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c9bfac3848bc2c53c034b03cf89a3aaa8f3a248
commit 8c9bfac3848bc2c53c034b03cf89a3aaa8f3a248
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 10 16:57:59 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Mar 10 17:12:00 2014 -0400

    Xcode: Convert forced CMAKE_<LANG>_COMPILER to full path if possible
    
    During cross-compiling the toolchain file may use CMakeForceCompiler to
    force a compiler setting.  When using the Xcode generator try to convert
    it to a full path by searching the PATH as is done for the Makefile
    generators.

diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 4f7ae24..aa4cdc9 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -42,6 +42,7 @@ endif()
 if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
   set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
+  _cmake_find_compiler_path(C)
 else()
   if(NOT CMAKE_C_COMPILER)
     set(CMAKE_C_COMPILER_INIT NOTFOUND)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index d60cff3..ef8445e 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -41,6 +41,7 @@ endif()
 if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
   set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
+  _cmake_find_compiler_path(CXX)
 else()
   if(NOT CMAKE_CXX_COMPILER)
     set(CMAKE_CXX_COMPILER_INIT NOTFOUND)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index f4aaa0a..d38bf25 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -28,6 +28,7 @@ endif()
 if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
   set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90)
+  _cmake_find_compiler_path(Fortran)
 else()
   if(NOT CMAKE_Fortran_COMPILER)
     # prefer the environment variable CC

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6852fb8034d30d14498dc874378881696a6ada23
commit 6852fb8034d30d14498dc874378881696a6ada23
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 10 16:51:41 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Mar 10 17:12:00 2014 -0400

    CMakeDetermine*Compiler: Factor out search for compiler in PATH
    
    Factor out a _cmake_find_compiler_path helper macro to avoid duplication
    of the search for a full path to the compiler.

diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index ca7eb8b..1d9617f 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -48,22 +48,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
   _cmake_find_compiler(ASM${ASM_DIALECT})
 
 else()
-
-  # we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt
-  # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
-  #
-  # if a compiler was specified by the user but without path,
-  # now try to find it with the full path
-  # if it is found, force it into the cache,
-  # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
-  get_filename_component(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
-  if(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
-    find_program(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
-    if(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
-      set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
-    endif()
-    unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH CACHE)
-  endif()
+  _cmake_find_compiler_path(ASM${ASM_DIALECT})
 endif()
 mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER)
 
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index c3f5a66..4f7ae24 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -72,31 +72,7 @@ else()
     _cmake_find_compiler(C)
 
   else()
-
-    # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt
-    # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
-    # if CMAKE_C_COMPILER is a list of length 2, use the first item as
-    # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1
-
-    list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH)
-    if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2)
-      list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1)
-      list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER)
-    endif()
-
-    # if a compiler was specified by the user but without path,
-    # now try to find it with the full path
-    # if it is found, force it into the cache,
-    # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
-    # if the C compiler already had a path, reuse it for searching the CXX compiler
-    get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH)
-    if(NOT _CMAKE_USER_C_COMPILER_PATH)
-      find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER})
-      if(CMAKE_C_COMPILER_WITH_PATH)
-        set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE)
-      endif()
-      unset(CMAKE_C_COMPILER_WITH_PATH CACHE)
-    endif()
+    _cmake_find_compiler_path(C)
   endif()
   mark_as_advanced(CMAKE_C_COMPILER)
 
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 21864f1..d60cff3 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -70,32 +70,7 @@ else()
 
     _cmake_find_compiler(CXX)
   else()
-
-    # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt
-    # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
-    #
-    # if CMAKE_CXX_COMPILER is a list of length 2, use the first item as
-    # CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1
-
-    list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH)
-    if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2)
-      list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1)
-      list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER)
-    endif()
-
-    # if a compiler was specified by the user but without path,
-    # now try to find it with the full path
-    # if it is found, force it into the cache,
-    # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
-    # if the CXX compiler already had a path, reuse it for searching the C compiler
-    get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH)
-    if(NOT _CMAKE_USER_CXX_COMPILER_PATH)
-      find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER})
-      if(CMAKE_CXX_COMPILER_WITH_PATH)
-        set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE)
-      endif()
-      unset(CMAKE_CXX_COMPILER_WITH_PATH CACHE)
-    endif()
+    _cmake_find_compiler_path(CXX)
   endif()
   mark_as_advanced(CMAKE_CXX_COMPILER)
 
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index f522c44..cd0f8b8 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -83,3 +83,33 @@ macro(_cmake_find_compiler lang)
     endforeach()
   endif()
 endmacro()
+
+macro(_cmake_find_compiler_path lang)
+  if(CMAKE_${lang}_COMPILER)
+    # we only get here if CMAKE_${lang}_COMPILER was specified using -D or a pre-made CMakeCache.txt
+    # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
+    # if CMAKE_${lang}_COMPILER is a list of length 2, use the first item as
+    # CMAKE_${lang}_COMPILER and the 2nd one as CMAKE_${lang}_COMPILER_ARG1
+    list(LENGTH CMAKE_${lang}_COMPILER _CMAKE_${lang}_COMPILER_LIST_LENGTH)
+    if("${_CMAKE_${lang}_COMPILER_LIST_LENGTH}" EQUAL 2)
+      list(GET CMAKE_${lang}_COMPILER 1 CMAKE_${lang}_COMPILER_ARG1)
+      list(GET CMAKE_${lang}_COMPILER 0 CMAKE_${lang}_COMPILER)
+    endif()
+    unset(_CMAKE_${lang}_COMPILER_LIST_LENGTH)
+
+    # find the compiler in the PATH if necessary
+    get_filename_component(_CMAKE_USER_${lang}_COMPILER_PATH "${CMAKE_${lang}_COMPILER}" PATH)
+    if(NOT _CMAKE_USER_${lang}_COMPILER_PATH)
+      find_program(CMAKE_${lang}_COMPILER_WITH_PATH NAMES ${CMAKE_${lang}_COMPILER})
+      if(CMAKE_${lang}_COMPILER_WITH_PATH)
+        set(CMAKE_${lang}_COMPILER ${CMAKE_${lang}_COMPILER_WITH_PATH})
+        get_property(_CMAKE_${lang}_COMPILER_CACHED CACHE CMAKE_${lang}_COMPILER PROPERTY TYPE)
+        if(_CMAKE_${lang}_COMPILER_CACHED)
+          set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE STRING "${lang} compiler" FORCE)
+        endif()
+        unset(_CMAKE_${lang}_COMPILER_CACHED)
+      endif()
+      unset(CMAKE_${lang}_COMPILER_WITH_PATH CACHE)
+    endif()
+  endif()
+endmacro()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 4c8a8f2..f4aaa0a 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -90,31 +90,7 @@ else()
     _cmake_find_compiler(Fortran)
 
   else()
-     # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt
-    # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
-    # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as
-    # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1
-
-    list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH)
-    if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2)
-      list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1)
-      list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER)
-    endif()
-
-    # if a compiler was specified by the user but without path,
-    # now try to find it with the full path
-    # if it is found, force it into the cache,
-    # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
-    # if the C compiler already had a path, reuse it for searching the CXX compiler
-    get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH)
-    if(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
-      find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER})
-      if(CMAKE_Fortran_COMPILER_WITH_PATH)
-        set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH}
-          CACHE STRING "Fortran compiler" FORCE)
-      endif()
-      unset(CMAKE_Fortran_COMPILER_WITH_PATH CACHE)
-    endif()
+    _cmake_find_compiler_path(Fortran)
   endif()
   mark_as_advanced(CMAKE_Fortran_COMPILER)
 

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

Summary of changes:
 Modules/CMakeDetermineASMCompiler.cmake     |   17 +--------------
 Modules/CMakeDetermineCCompiler.cmake       |   27 ++----------------------
 Modules/CMakeDetermineCXXCompiler.cmake     |   28 ++-----------------------
 Modules/CMakeDetermineCompiler.cmake        |   30 +++++++++++++++++++++++++++
 Modules/CMakeDetermineFortranCompiler.cmake |   27 ++----------------------
 5 files changed, 37 insertions(+), 92 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list