summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-05-16 18:30:56 (GMT)
committerBrad King <brad.king@kitware.com>2019-05-16 18:31:30 (GMT)
commit086c51dc045c75662500b39da3341af83281d6df (patch)
tree34b21b41b8ea98f9346c655f135e174d8bb41c28
parent64a7f491ef8ab6f70a77f89c91d1e7e9d549333e (diff)
downloadCMake-086c51dc045c75662500b39da3341af83281d6df.zip
CMake-086c51dc045c75662500b39da3341af83281d6df.tar.gz
CMake-086c51dc045c75662500b39da3341af83281d6df.tar.bz2
CMakeDetermineCompilerId: Make CMAKE_${lang}_COMPILER available earlier
If compiler id detection gave us the compiler tool, copy its value to the `CMAKE_${lang}_COMPILER` variable as early as possible.
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake15
1 files changed, 8 insertions, 7 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 1cd919a..7bf13fa 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -46,6 +46,14 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endforeach()
+ # Check if compiler id detection gave us the compiler tool.
+ if(CMAKE_${lang}_COMPILER_ID_TOOL)
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}")
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
+ elseif(NOT CMAKE_${lang}_COMPILER)
+ set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
+ endif()
+
# If the compiler is still unknown, try to query its vendor.
if(CMAKE_${lang}_COMPILER AND NOT CMAKE_${lang}_COMPILER_ID)
foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
@@ -124,13 +132,6 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
message(STATUS "The ${lang} compiler identification is unknown")
endif()
- # Check if compiler id detection gave us the compiler tool.
- if(CMAKE_${lang}_COMPILER_ID_TOOL)
- set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
- elseif(NOT CMAKE_${lang}_COMPILER)
- set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
- endif()
-
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}" PARENT_SCOPE)