diff options
author | Hannes Vogt <hannes@havogt.de> | 2020-03-18 16:47:06 (GMT) |
---|---|---|
committer | Hannes Vogt <hannes@havogt.de> | 2020-03-18 16:47:06 (GMT) |
commit | 36baf1f13c999eae8cf0dd9cd3899356d4856eda (patch) | |
tree | d3cea54da0b0628571bcb048b5c17de2a99c717f /Modules/CheckLanguage.cmake | |
parent | 863b0fa2aca3ece98d177f2dbafcad56f7037c8a (diff) | |
download | CMake-36baf1f13c999eae8cf0dd9cd3899356d4856eda.zip CMake-36baf1f13c999eae8cf0dd9cd3899356d4856eda.tar.gz CMake-36baf1f13c999eae8cf0dd9cd3899356d4856eda.tar.bz2 |
CheckLanguage: hide commonly used variable names
The check_language sets internal variables with a common name in the
caller's scope: `result`, `output` and `content`.
They are now prefixed with `_cl_`,
inspired by the CheckLibraryExists module.
Diffstat (limited to 'Modules/CheckLanguage.cmake')
-rw-r--r-- | Modules/CheckLanguage.cmake | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 997cc8d..f48107a 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -47,7 +47,7 @@ macro(check_language lang) set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")") endif() - set(content + set(_cl_content "cmake_minimum_required(VERSION ${CMAKE_VERSION}) project(Check${lang} ${lang}) file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" @@ -57,7 +57,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" ) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt" - "${content}") + "${_cl_content}") if(CMAKE_GENERATOR_INSTANCE) set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") else() @@ -75,22 +75,22 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" -T "${CMAKE_GENERATOR_TOOLSET}" ${_D_CMAKE_GENERATOR_INSTANCE} ${_D_CMAKE_MAKE_PROGRAM} - OUTPUT_VARIABLE output - ERROR_VARIABLE output - RESULT_VARIABLE result + OUTPUT_VARIABLE _cl_output + ERROR_VARIABLE _cl_output + RESULT_VARIABLE _cl_result ) include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL) - if(CMAKE_${lang}_COMPILER AND "${result}" STREQUAL "0") + if(CMAKE_${lang}_COMPILER AND "${_cl_result}" STREQUAL "0") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${_desc} passed with the following output:\n" - "${output}\n") + "${_cl_output}\n") set(_CHECK_COMPILER_STATUS CHECK_PASS) else() set(CMAKE_${lang}_COMPILER NOTFOUND) set(_CHECK_COMPILER_STATUS CHECK_FAIL) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${_desc} failed with the following output:\n" - "${output}\n") + "${_cl_output}\n") endif() message(${_CHECK_COMPILER_STATUS} "${CMAKE_${lang}_COMPILER}") set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler") |