mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 02:19:18 -05:00
Merge topic 'try_compile-linker-language'
0f37000304try_{compile,run}: add LINKER_LANGUAGE optiondc0dbffb0fTests: Remove redundant policy setting from RunCMake.try_{compile,run} cases Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8871
This commit is contained in:
@@ -178,6 +178,7 @@ auto const TryCompileBaseSourcesArgParser =
|
||||
ArgumentParser::ExpectAtLeast{ 0 })
|
||||
.Bind("LINK_LIBRARIES"_s, &Arguments::LinkLibraries)
|
||||
.Bind("LINK_OPTIONS"_s, &Arguments::LinkOptions)
|
||||
.Bind("LINKER_LANGUAGE"_s, &Arguments::LinkerLanguage)
|
||||
.Bind("COPY_FILE"_s, &Arguments::CopyFileTo)
|
||||
.Bind("COPY_FILE_ERROR"_s, &Arguments::CopyFileError)
|
||||
.BIND_LANG_PROPS(C)
|
||||
@@ -1045,6 +1046,19 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.LinkerLanguage) {
|
||||
std::string LinkerLanguage = *arguments.LinkerLanguage;
|
||||
if (testLangs.find(LinkerLanguage) == testLangs.end()) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"Linker language '" + LinkerLanguage +
|
||||
"' must be enabled in project(LANGUAGES).");
|
||||
}
|
||||
|
||||
fprintf(fout, "set_property(TARGET %s PROPERTY LINKER_LANGUAGE %s)\n",
|
||||
targetName.c_str(), LinkerLanguage.c_str());
|
||||
}
|
||||
|
||||
if (arguments.LinkLibraries) {
|
||||
std::string libsToLink = " ";
|
||||
for (std::string const& i : *arguments.LinkLibraries) {
|
||||
|
||||
Reference in New Issue
Block a user