From 705ae0049190dfa9e79e13c423c509b112a5e25b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 22 Oct 2013 14:05:23 -0400 Subject: Quote ${CMAKE__COMPILER} while enabling a language Even though this variable gets set to CMAKE__COMPILER-NOTFOUND when the compiler is not found, CMakeCompiler.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. --- Modules/CMakeCInformation.cmake | 2 +- Modules/CMakeCXXInformation.cmake | 2 +- Modules/CMakeDetermineCompilerId.cmake | 6 +++--- Modules/CMakeFortranInformation.cmake | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index ce5ce44..0f5b694 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -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() diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 933c15a..45ec95a 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -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++) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index bb260f6..6fccb16 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -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} diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 512ec48..debfd46 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -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) -- cgit v0.12