diff options
author | Brad King <brad.king@kitware.com> | 2023-01-16 13:44:48 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-13 14:29:50 -0400 |
commit | 9f54901ed964491c71955f6d6f7b6a9ccec11e0f (patch) | |
tree | 71b4840c221733dc0f8bdd4647ff38f8073efbea | |
parent | 5709a7e572df220655659155d26b2f56cb97acf3 (diff) | |
download | cmake-9f54901ed964491c71955f6d6f7b6a9ccec11e0f.tar.gz |
CompilerId: Restore logging of failed identifications in CMake 3.25
Changes in commit 9c5bd7fe3a (CompilerId: Output errors from all
attempts at detection, 2022-08-16, v3.25.0-rc1~290^2) accidentally
stopped logging failed compiler identification build output.
This was fixed for CMake 3.26 and later by commit 24ccc8c3c9
(CompilerId: Restore logging of failed identifications, 2023-01-16,
v3.26.0-rc1~70^2~6). Backport it to 3.25.
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 73c775aeb3..97e376189d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -720,7 +720,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "warning #5117: Bad # preprocessor line" ) # Compilation failed. - string(APPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG + set(MSG "Compiling the ${lang} compiler identification source file \"${src}\" failed. ${COMPILER_DESCRIPTION} The output was: @@ -733,11 +733,13 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") endif() + string(APPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG "${MSG}") + # Some languages may know the correct/desired set of flags and want to fail right away if they don't work. # This is currently only used by CUDA. if(__compiler_id_require_success) message(FATAL_ERROR "${_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG}") - else() + elseif(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS) # Build up the outputs for compiler detection attempts so that users # can see all set of flags tried, instead of just last set(_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG "${_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG}" PARENT_SCOPE) |