Merge topic 'object-library-no-TARGET_FILE'

d960589 Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)
This commit is contained in:
Brad King 2013-11-02 10:54:23 -04:00 committed by CMake Topic Stage
commit 872a9d6476
6 changed files with 36 additions and 1 deletions

View File

@ -1341,7 +1341,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"No target \"" + name + "\"");
return std::string();
}
if(target->GetType() >= cmTarget::UTILITY &&
if(target->GetType() >= cmTarget::OBJECT_LIBRARY &&
target->GetType() != cmTarget::UNKNOWN_LIBRARY)
{
::reportError(context, content->GetOriginalExpression(),

View File

@ -0,0 +1,26 @@
CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\):
Error evaluating generator expression:
\$<TARGET_FILE:objlib>
Target "objlib" is not an executable or library.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\):
Error evaluating generator expression:
\$<TARGET_SONAME_FILE:objlib>
Target "objlib" is not an executable or library.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\):
Error evaluating generator expression:
\$<TARGET_LINKER_FILE:objlib>
Target "objlib" is not an executable or library.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1,7 @@
enable_language(C)
add_library(objlib OBJECT empty.c)
add_custom_target(check ALL COMMAND echo
$<TARGET_FILE:objlib>
$<TARGET_SONAME_FILE:objlib>
$<TARGET_LINKER_FILE:objlib>
)

View File

@ -7,4 +7,5 @@ run_cmake(BadNOT)
run_cmake(BadStrEqual)
run_cmake(BadZero)
run_cmake(BadTargetName)
run_cmake(BadTargetTypeObject)
run_cmake(BadInstallPrefix)