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

Store ABI detection results in compiler information files

Drop use of cache entry CMAKE_DETERMINE_<LANG>_ABI_COMPILED and replace
it with variable CMAKE_<LANG>_ABI_COMPILED.  Since the grandparent
commit this test result is specific to the version of CMake.  Store it
in the version-specific compiler information files instead of
CMakeCache.txt so testing can be re-done to meet the requirements of the
current version of CMake even if another version of CMake was already
used to configure the build tree.
Brad King 13 жил өмнө
parent
commit
e5fee8a7c2

+ 1 - 0
Modules/CMakeCCompiler.cmake.in

@@ -10,6 +10,7 @@ set(CMAKE_LINKER "@CMAKE_LINKER@")
 set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
 set(CMAKE_C_COMPILER_LOADED 1)
 set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@)
+set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@)
 set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
 set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
 if(CMAKE_COMPILER_IS_CYGWIN)

+ 1 - 0
Modules/CMakeCXXCompiler.cmake.in

@@ -10,6 +10,7 @@ set(CMAKE_LINKER "@CMAKE_LINKER@")
 set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
 set(CMAKE_CXX_COMPILER_LOADED 1)
 set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@)
+set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@)
 set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
 set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
 if(CMAKE_COMPILER_IS_CYGWIN)

+ 7 - 3
Modules/CMakeDetermineCompilerABI.cmake

@@ -19,7 +19,7 @@
 include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
 
 function(CMAKE_DETERMINE_COMPILER_ABI lang src)
-  if(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+  if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED)
     message(STATUS "Detecting ${lang} compiler ABI info")
 
     # Compile the ABI identification source.
@@ -28,7 +28,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
     if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
       set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
     endif()
-    try_compile(CMAKE_DETERMINE_${lang}_ABI_COMPILED
+    try_compile(CMAKE_${lang}_ABI_COMPILED
       ${CMAKE_BINARY_DIR} ${src}
       CMAKE_FLAGS "${CMAKE_FLAGS}"
                   "-DCMAKE_${lang}_STANDARD_LIBRARIES="
@@ -39,9 +39,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
       OUTPUT_VARIABLE OUTPUT
       COPY_FILE "${BIN}"
       )
+    # Move result from cache to normal variable.
+    set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED})
+    unset(CMAKE_${lang}_ABI_COMPILED CACHE)
+    set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED} PARENT_SCOPE)
 
     # Load the resulting information strings.
-    if(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+    if(CMAKE_${lang}_ABI_COMPILED)
       message(STATUS "Detecting ${lang} compiler ABI info - done")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")

+ 1 - 0
Modules/CMakeFortranCompiler.cmake.in

@@ -8,6 +8,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@")
 set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
 set(CMAKE_Fortran_COMPILER_LOADED 1)
 set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@)
+set(CMAKE_Fortran_ABI_COMPILED @CMAKE_Fortran_ABI_COMPILED@)
 set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
 set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
 if(CMAKE_COMPILER_IS_CYGWIN)