summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-30 11:22:54 -0400
committerBrad King <brad.king@kitware.com>2018-08-30 11:46:19 -0400
commit4e1ea02bb86f40d8ba0c247869a508b1da2c84b1 (patch)
tree74a8c8a9648b856fecbeff429cbedd6de2df311b
parentb7dbb25a0a18187e85e6def956bc5516a3284b90 (diff)
downloadcmake-4e1ea02bb86f40d8ba0c247869a508b1da2c84b1.tar.gz
CheckIPOSupported: Tolerate backslashes in output of failed checks
Avoid passing the output of our `try_compile` through a macro argument. Macro invocations re-parse their arguments and so should not be given arbitrary content that may contain backslashes and such. Instead pass a simple message. This is also more readable in the case that the macro generates a message itself. After the macro returns, report the real output directly to the variable named by our caller. Also record the output in a log file as other checks do on failure. Fixes: #18244
-rw-r--r--Modules/CheckIPOSupported.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index de2a1404e3..3344834cd4 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -126,7 +126,13 @@ macro(_ipo_run_language_check language)
)
if(NOT result)
- _ipo_not_supported("${output}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${language} compiler IPO check failed with the following output:\n"
+ "${output}\n")
+ _ipo_not_supported("check failed to compile")
+ if(X_OUTPUT)
+ set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+ endif()
return()
endif()
endmacro()