1
0
Эх сурвалжийг харах

ENH: When detecting the compiler id try compiling only to an object file.

Brad King 17 жил өмнө
parent
commit
a75079d9e0

+ 8 - 0
Modules/CMakeDetermineCCompiler.cmake

@@ -112,6 +112,14 @@ ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 IF(NOT CMAKE_C_COMPILER_ID_RUN)
 IF(NOT CMAKE_C_COMPILER_ID_RUN)
   SET(CMAKE_C_COMPILER_ID_RUN 1)
   SET(CMAKE_C_COMPILER_ID_RUN 1)
 
 
+  # Each entry in this list is a set of extra flags to try
+  # adding to the compile line to see if it helps produce
+  # a valid identification file.
+  SET(CMAKE_C_COMPILER_ID_TEST_FLAGS
+    # Try compiling to an object file only.
+    "-c"
+    )
+
   # Try to identify the compiler.
   # Try to identify the compiler.
   SET(CMAKE_C_COMPILER_ID)
   SET(CMAKE_C_COMPILER_ID)
   INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
   INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)

+ 8 - 0
Modules/CMakeDetermineCXXCompiler.cmake

@@ -122,6 +122,14 @@ ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
 IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
   SET(CMAKE_CXX_COMPILER_ID_RUN 1)
   SET(CMAKE_CXX_COMPILER_ID_RUN 1)
 
 
+  # Each entry in this list is a set of extra flags to try
+  # adding to the compile line to see if it helps produce
+  # a valid identification file.
+  SET(CMAKE_CXX_COMPILER_ID_TEST_FLAGS
+    # Try compiling to an object file only.
+    "-c"
+    )
+
   # Try to identify the compiler.
   # Try to identify the compiler.
   SET(CMAKE_CXX_COMPILER_ID)
   SET(CMAKE_CXX_COMPILER_ID)
   INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
   INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)

+ 3 - 0
Modules/CMakeDetermineFortranCompiler.cmake

@@ -84,6 +84,9 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
   # adding to the compile line to see if it helps produce
   # adding to the compile line to see if it helps produce
   # a valid identification executable.
   # a valid identification executable.
   SET(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS
   SET(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS
+    # Try compiling to an object file only.
+    "-c"
+
     # Intel on windows does not preprocess by default.
     # Intel on windows does not preprocess by default.
     "-fpp"
     "-fpp"
     )
     )