Merge topic 'try_compile-verbose'

faa950a155 try_compile: Run native build tool with verbose output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8095
This commit is contained in:
Brad King 2023-01-23 15:34:19 +00:00 committed by Kitware Robot
commit f4d604f77f
5 changed files with 26 additions and 2 deletions

View File

@ -2049,7 +2049,7 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
cmBuildOptions defaultBuildOptions(false, fast, PackageResolveMode::Disable);
return this->Build(jobs, srcdir, bindir, projectName, newTarget, output, "",
config, defaultBuildOptions, false,
config, defaultBuildOptions, true,
this->TryCompileTimeout);
}

View File

@ -1 +1 @@
.*Linking ISPC static library*
(Linking ISPC static library|[ \/]libcmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.a|out:([A-Za-z]+[\/])?cmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.lib)

View File

@ -45,6 +45,8 @@ run_cmake(ProjectCopyFile)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
run_cmake(Verbose)
set(RunCMake_TEST_OPTIONS --debug-trycompile)
run_cmake(PlatformVariables)
run_cmake(WarnDeprecated)

View File

@ -0,0 +1,7 @@
#ifndef EXAMPLE_DEFINITION
# error "EXAMPLE_DEFINITION not defined."
#endif
int main(void)
{
return 0;
}

View File

@ -0,0 +1,15 @@
enable_language(C)
try_compile(COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Verbose.c
COMPILE_DEFINITIONS -DEXAMPLE_DEFINITION
OUTPUT_VARIABLE out
)
string(REPLACE "\n" "\n " out " ${out}")
if(NOT COMPILE_RESULT)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
if(NOT out MATCHES "EXAMPLE_DEFINITION"
AND NOT CMAKE_GENERATOR MATCHES "NMake|Borland")
message(FATAL_ERROR "try_compile output does not contain EXAMPLE_DEFINITION:\n${out}")
endif()