Quote ${CMAKE_<LANG>_COMPILER} while enabling a language

Even though this variable gets set to CMAKE_<LANG>_COMPILER-NOTFOUND when
the compiler is not found, CMake<LANG>Compiler.cmake gets removed by
cmGlobalGenerator::EnableLanguage so in try compiles the value is empty.
Quote references to the variable in

 Modules/CMake(C|CXX|Fortran)Information.cmake
 Modules/CMakeDetermineCompilerId.cmake

to avoid dropping arguments from commands that expect them.
This commit is contained in:
Brad King 2013-10-22 14:05:23 -04:00
parent 18a253732d
commit 705ae00491
4 changed files with 6 additions and 6 deletions

View File

@ -34,7 +34,7 @@ if(CMAKE_C_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
get_filename_component(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
get_filename_component(CMAKE_BASE_NAME "${CMAKE_C_COMPILER}" NAME_WE)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_BASE_NAME gcc)
endif()

View File

@ -34,7 +34,7 @@ if(CMAKE_CXX_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
get_filename_component(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
get_filename_component(CMAKE_BASE_NAME "${CMAKE_CXX_COMPILER}" NAME_WE)
# since the gnu compiler has several names force g++
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_BASE_NAME g++)

View File

@ -232,7 +232,7 @@ Id flags: ${testflags}
else()
if(COMMAND EXECUTE_PROCESS)
execute_process(
COMMAND ${CMAKE_${lang}_COMPILER}
COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
@ -244,7 +244,7 @@ Id flags: ${testflags}
)
else()
exec_program(
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
"${CMAKE_${lang}_COMPILER}" ${CMAKE_${lang}_COMPILER_ID_DIR}
ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
@ -476,7 +476,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
set(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
execute_process(
COMMAND ${CMAKE_${lang}_COMPILER}
COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${flags}

View File

@ -24,7 +24,7 @@ if(CMAKE_Fortran_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
get_filename_component(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
get_filename_component(CMAKE_BASE_NAME "${CMAKE_Fortran_COMPILER}" NAME_WE)
# since the gnu compiler has several names force g++
if(CMAKE_COMPILER_IS_GNUG77)
set(CMAKE_BASE_NAME g77)