mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 19:30:13 -06:00
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
This commit is contained in:
committed by
Brad King
parent
cbf3252975
commit
7e6b2a92a0
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
11
Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt
Normal file
11
Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt
Normal file
@@ -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\)
|
||||
11
Tests/RunCMake/try_compile/PlatformVariables-stderr.txt
Normal file
11
Tests/RunCMake/try_compile/PlatformVariables-stderr.txt
Normal file
@@ -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\)
|
||||
11
Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt
Normal file
11
Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt
Normal file
@@ -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\)
|
||||
Reference in New Issue
Block a user