Merge topic 'test-compiler-output-var'
5f6985a
Avoid clobbering variable 'OUTPUT' in compiler tests (#12628)
This commit is contained in:
commit
8f8ee53729
|
@ -35,7 +35,7 @@ IF(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
"{ (void)argv; return argc-1;}\n")
|
"{ (void)argv; return argc-1;}\n")
|
||||||
TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT)
|
||||||
SET(C_TEST_WAS_RUN 1)
|
SET(C_TEST_WAS_RUN 1)
|
||||||
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
|
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ IF(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
PrintTestCompilerStatus("C" " -- broken")
|
PrintTestCompilerStatus("C" " -- broken")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||||
"Determining if the C compiler works failed with "
|
"Determining if the C compiler works failed with "
|
||||||
"the following output:\n${OUTPUT}\n\n")
|
"the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n")
|
||||||
# if the compiler is broken make sure to remove the platform file
|
# if the compiler is broken make sure to remove the platform file
|
||||||
# since Windows-cl configures both c/cxx files both need to be removed
|
# since Windows-cl configures both c/cxx files both need to be removed
|
||||||
# when c or c++ fails
|
# when c or c++ fails
|
||||||
|
@ -51,14 +51,14 @@ IF(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
|
FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
|
||||||
MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" "
|
MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" "
|
||||||
"is not able to compile a simple test program.\nIt fails "
|
"is not able to compile a simple test program.\nIt fails "
|
||||||
"with the following output:\n ${OUTPUT}\n\n"
|
"with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n"
|
||||||
"CMake will not be able to correctly generate this project.")
|
"CMake will not be able to correctly generate this project.")
|
||||||
ELSE(NOT CMAKE_C_COMPILER_WORKS)
|
ELSE(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
IF(C_TEST_WAS_RUN)
|
IF(C_TEST_WAS_RUN)
|
||||||
PrintTestCompilerStatus("C" " -- works")
|
PrintTestCompilerStatus("C" " -- works")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Determining if the C compiler works passed with "
|
"Determining if the C compiler works passed with "
|
||||||
"the following output:\n${OUTPUT}\n\n")
|
"the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n")
|
||||||
ENDIF(C_TEST_WAS_RUN)
|
ENDIF(C_TEST_WAS_RUN)
|
||||||
SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
|
SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||||
|
|
||||||
|
@ -84,3 +84,4 @@ ELSE(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
|
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
|
||||||
|
|
||||||
|
UNSET(__CMAKE_C_COMPILER_OUTPUT)
|
||||||
|
|
|
@ -28,7 +28,7 @@ IF(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
"int main(){return 0;}\n")
|
"int main(){return 0;}\n")
|
||||||
TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT)
|
||||||
SET(CXX_TEST_WAS_RUN 1)
|
SET(CXX_TEST_WAS_RUN 1)
|
||||||
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
|
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
|
|
||||||
|
@ -41,17 +41,17 @@ IF(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
|
FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||||
"Determining if the CXX compiler works failed with "
|
"Determining if the CXX compiler works failed with "
|
||||||
"the following output:\n${OUTPUT}\n\n")
|
"the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
|
||||||
MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" "
|
MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" "
|
||||||
"is not able to compile a simple test program.\nIt fails "
|
"is not able to compile a simple test program.\nIt fails "
|
||||||
"with the following output:\n ${OUTPUT}\n\n"
|
"with the following output:\n ${__CMAKE_CXX_COMPILER_OUTPUT}\n\n"
|
||||||
"CMake will not be able to correctly generate this project.")
|
"CMake will not be able to correctly generate this project.")
|
||||||
ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
|
ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
IF(CXX_TEST_WAS_RUN)
|
IF(CXX_TEST_WAS_RUN)
|
||||||
PrintTestCompilerStatus("CXX" " -- works")
|
PrintTestCompilerStatus("CXX" " -- works")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Determining if the CXX compiler works passed with "
|
"Determining if the CXX compiler works passed with "
|
||||||
"the following output:\n${OUTPUT}\n\n")
|
"the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
|
||||||
ENDIF(CXX_TEST_WAS_RUN)
|
ENDIF(CXX_TEST_WAS_RUN)
|
||||||
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
|
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||||
|
|
||||||
|
@ -76,3 +76,5 @@ ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
UNSET(CMAKE_CXX_ABI_FILES)
|
UNSET(CMAKE_CXX_ABI_FILES)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
|
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
|
||||||
|
|
||||||
|
UNSET(__CMAKE_CXX_COMPILER_OUTPUT)
|
||||||
|
|
Loading…
Reference in New Issue