CMakeDetermineCompiler: Simplify CMAKE_<LANG>_COMPILER default force-cache

If find_program does not find CMAKE_<LANG>_COMPILER, use set_property()
to force the value to be that of CMAKE_<LANG>_COMPILER_INIT instead of
set().  This allows us to set the value without re-specifying the type
and documentation, thus preserving what find_program set.
This commit is contained in:
Brad King 2014-07-24 13:10:05 -04:00
parent 731427a646
commit 8981513a81
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ macro(_cmake_find_compiler lang)
endif() endif()
find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE) set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
endif() endif()
unset(_${lang}_COMPILER_HINTS) unset(_${lang}_COMPILER_HINTS)
unset(_languages) unset(_languages)