Merge topic 'fix-TARGET_FILE-imported'
35aab9df
Reject TARGET_PDB_FILE for imported targets instead of crashing
This commit is contained in:
commit
e8592e555f
|
@ -1600,6 +1600,13 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
|
|||
cmGeneratorExpressionContext *context,
|
||||
const GeneratorExpressionContent *content)
|
||||
{
|
||||
if (target->IsImported())
|
||||
{
|
||||
::reportError(context, content->GetOriginalExpression(),
|
||||
"TARGET_PDB_FILE not allowed for IMPORTED targets.");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string language = target->GetLinkerLanguage(context->Config);
|
||||
|
||||
std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
|
||||
|
|
|
@ -1248,6 +1248,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
|
|||
UNORDERED_SET<std::string> languages;
|
||||
cmTarget::LinkImplementation const* impl =
|
||||
this->Target->GetLinkImplementation(config);
|
||||
assert(impl);
|
||||
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
||||
li != impl->Languages.end(); ++li)
|
||||
{
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,8 @@
|
|||
CMake Error at ImportedTarget-TARGET_PDB_FILE.cmake:2 \(add_custom_target\):
|
||||
Error evaluating generator expression:
|
||||
|
||||
\$<TARGET_PDB_FILE:empty>
|
||||
|
||||
TARGET_PDB_FILE not allowed for IMPORTED targets.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
|||
add_library(empty UNKNOWN IMPORTED)
|
||||
add_custom_target(custom COMMAND echo $<TARGET_PDB_FILE:empty>)
|
|
@ -26,6 +26,7 @@ run_cmake(COMPILE_LANGUAGE-add_library)
|
|||
run_cmake(COMPILE_LANGUAGE-add_test)
|
||||
run_cmake(COMPILE_LANGUAGE-unknown-lang)
|
||||
|
||||
run_cmake(ImportedTarget-TARGET_PDB_FILE)
|
||||
if(LINKER_SUPPORTS_PDB)
|
||||
run_cmake(NonValidTarget-TARGET_PDB_FILE)
|
||||
run_cmake(ValidTarget-TARGET_PDB_FILE)
|
||||
|
|
Loading…
Reference in New Issue