summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-08-16 15:59:46 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-08-16 15:59:46 (GMT)
commit9c5bd7fe3acc18fc5c1a4d22b1435aeb34d274e6 (patch)
tree650da2d74c4a825946569694fa057b710da46f9d /Modules/CMakeDetermineCompilerId.cmake
parent9ce5018be9f8ffd2bcfda00b9c1b81d3401e20ba (diff)
downloadCMake-9c5bd7fe3acc18fc5c1a4d22b1435aeb34d274e6.zip
CMake-9c5bd7fe3acc18fc5c1a4d22b1435aeb34d274e6.tar.gz
CMake-9c5bd7fe3acc18fc5c1a4d22b1435aeb34d274e6.tar.bz2
CompilerId: Output errors from all attempts at detection
Instead of printing the output of the last attempt, print the output of all attempts. This shows users that CMake isn't ignoring any provided flags ( LANG_FLAGS ).
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 2b19736..6b58549 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.
- set(MSG
+ string(APPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG
"Compiling the ${lang} compiler identification source file \"${src}\" failed.
${COMPILER_DESCRIPTION}
The output was:
@@ -736,7 +736,11 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# 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 "${MSG}")
+ message(FATAL_ERROR "${_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG}")
+ else()
+ # 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)
endif()
# No output files should be inspected.