diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-10-04 20:42:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-06 12:13:03 (GMT) |
commit | 7e6b2a92a0a3fe1261c1ecb5db2acb7e30a4f75c (patch) | |
tree | 59b492910729614d7a7ff1212be24706c6a7ea87 | |
parent | cbf3252975ef4acf9d1f11130bf03a8431998697 (diff) | |
download | CMake-7e6b2a92a0a3fe1261c1ecb5db2acb7e30a4f75c.zip CMake-7e6b2a92a0a3fe1261c1ecb5db2acb7e30a4f75c.tar.gz CMake-7e6b2a92a0a3fe1261c1ecb5db2acb7e30a4f75c.tar.bz2 |
try_compile: Report build dir with --debug-trycompile
When `--debug-trycompile` is enabled, issue a log (with trace) for every
`try_compile` noting what directory is being used for the compilation.
This will make it easier to find the corresponding artifacts.
Closes: #24022
-rw-r--r-- | Help/manual/cmake.1.rst | 5 | ||||
-rw-r--r-- | Help/release/dev/try_compile-signatures.rst | 5 | ||||
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt | 11 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/PlatformVariables-stderr.txt | 11 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt | 11 |
6 files changed, 49 insertions, 1 deletions
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 868dac4..801229e 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -292,6 +292,11 @@ Options is effectively a :command:`try_compile`. Any combination of the two is subject to the potential issues described.) + .. versionadded:: 3.25 + + When this option is enabled, every try-compile check prints a log + message reporting the directory in which the check is performed. + .. option:: --debug-output Put cmake in a debug mode. diff --git a/Help/release/dev/try_compile-signatures.rst b/Help/release/dev/try_compile-signatures.rst index d477d989..c32babd 100644 --- a/Help/release/dev/try_compile-signatures.rst +++ b/Help/release/dev/try_compile-signatures.rst @@ -5,4 +5,7 @@ try_compile-signatures signatures that more consistently use keyword dispatch and do not require a binary directory to be specified. Additionally, these signatures use a unique directory for each invocation, which allows multiple outputs to be - preserved when using ``--debug-trycompile``. + preserved when using :option:`--debug-trycompile <cmake --debug-trycompile>`. + +* The :option:`cmake --debug-trycompile` option now prints log messages + reporting the directory in which each try-compile check is done. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index cdf8efa..588f44a 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -1050,6 +1050,13 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments, } } + if (this->Makefile->GetCMakeInstance()->GetDebugTryCompile()) { + auto msg = + cmStrCat("Executing try_compile (", *arguments.CompileResultVariable, + ") in:\n ", this->BinaryDirectory); + this->Makefile->IssueMessage(MessageType::LOG, msg); + } + bool erroroc = cmSystemTools::GetErrorOccurredFlag(); cmSystemTools::ResetErrorOccurredFlag(); std::string output; diff --git a/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt b/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt new file mode 100644 index 0000000..e987300 --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt @@ -0,0 +1,11 @@ +^CMake Debug Log at [^ +]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\): + Executing try_compile \(CMAKE_C_ABI_COMPILED\) in: + + [^ +]*/Tests/RunCMake/CommandLine/debug-trycompile-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+ +Call Stack \(most recent call first\): + [^ +]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\) + debug-trycompile.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt b/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt new file mode 100644 index 0000000..4a42b2d --- /dev/null +++ b/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt @@ -0,0 +1,11 @@ +^CMake Debug Log at [^ +]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\): + Executing try_compile \(CMAKE_C_ABI_COMPILED\) in: + + [^ +]*/Tests/RunCMake/try_compile/PlatformVariables-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+ +Call Stack \(most recent call first\): + [^ +]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\) + PlatformVariables.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt b/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt new file mode 100644 index 0000000..6474990 --- /dev/null +++ b/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt @@ -0,0 +1,11 @@ +^CMake Debug Log at [^ +]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\): + Executing try_compile \(CMAKE_C_ABI_COMPILED\) in: + + [^ +]*/Tests/RunCMake/try_compile/WarnDeprecated-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+ +Call Stack \(most recent call first\): + [^ +]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\) + WarnDeprecated.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) |