[cmake-commits] alex committed CMakeDetermineCCompiler.cmake 1.41 1.42 CMakeDetermineCXXCompiler.cmake 1.36 1.37

cmake-commits at cmake.org cmake-commits at cmake.org
Mon May 21 10:58:06 EDT 2007


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

Modified Files:
	CMakeDetermineCCompiler.cmake CMakeDetermineCXXCompiler.cmake 
Log Message:

BUG: don't fail if a compiler is given in CMAKE_C/CXX_COMPILER but it can't
be found in the path

Alex


Index: CMakeDetermineCXXCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCXXCompiler.cmake,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- CMakeDetermineCXXCompiler.cmake	17 May 2007 17:20:43 -0000	1.36
+++ CMakeDetermineCXXCompiler.cmake	21 May 2007 14:58:04 -0000	1.37
@@ -60,13 +60,21 @@
   ENDIF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER)
 ELSE(NOT CMAKE_CXX_COMPILER)
 
+# 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 a compiler was specified by the user but without path, 
-# now try to find it with the full path and force it into the cache
+# 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})
     MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_WITH_PATH)
-    SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE FILEPATH "CXX compiler" FORCE)
+    IF(CMAKE_CXX_COMPILER_WITH_PATH)
+      SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE FILEPATH "CXX compiler" FORCE)
+    ENDIF(CMAKE_CXX_COMPILER_WITH_PATH)
   ENDIF(NOT _CMAKE_USER_CXX_COMPILER_PATH)
 ENDIF(NOT CMAKE_CXX_COMPILER)
 MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)

Index: CMakeDetermineCCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCCompiler.cmake,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- CMakeDetermineCCompiler.cmake	17 May 2007 17:20:43 -0000	1.41
+++ CMakeDetermineCCompiler.cmake	21 May 2007 14:58:04 -0000	1.42
@@ -63,12 +63,17 @@
 ELSE(NOT CMAKE_C_COMPILER)
 
   # if a compiler was specified by the user but without path, 
-  # now try to find it with the full path and force it into the cache
+  # 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})
     MARK_AS_ADVANCED(CMAKE_C_COMPILER_WITH_PATH)
-    SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE FILEPATH "C compiler" FORCE)
+    IF(CMAKE_C_COMPILER_WITH_PATH)
+      SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE FILEPATH "C compiler" FORCE)
+    ENDIF(CMAKE_C_COMPILER_WITH_PATH)
   ENDIF(NOT _CMAKE_USER_C_COMPILER_PATH)
 ENDIF(NOT CMAKE_C_COMPILER)
 MARK_AS_ADVANCED(CMAKE_C_COMPILER)



More information about the Cmake-commits mailing list