From deec2f587cd0bd08ee6866d06b9600dee98af910 Mon Sep 17 00:00:00 2001 From: Fred Baksik Date: Wed, 15 Jul 2020 15:03:45 -0400 Subject: Toolchain: Take CMAKE__FLAGS_INIT into account during compiler detection Fixes: #20040 --- Modules/CMakeDetermineCompilerId.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 832b18d..d7a35e1 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -14,8 +14,10 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Make sure user-specified compiler flags are used. if(CMAKE_${lang}_FLAGS) set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) - else() + elseif(DEFINED ENV{${flagvar}}) set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) + else(CMAKE_${lang}_FLAGS_INIT) + set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS_INIT}) endif() string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") -- cgit v0.12