Merge topic 'consistent-genex-target-message'
fb2fa476
Genex: Clarify error message on use with non-binary targets (#14899).
This commit is contained in:
commit
060c86a506
|
@ -457,8 +457,8 @@ static const struct CCompilerIdNode : public CompilerIdNode
|
||||||
if (!context->HeadTarget)
|
if (!context->HeadTarget)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<C_COMPILER_ID> may only be used with targets. It may not "
|
"$<C_COMPILER_ID> may only be used with binary targets. It may "
|
||||||
"be used with add_custom_command.");
|
"not be used with add_custom_command or add_custom_target.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return this->EvaluateWithLanguage(parameters, context, content,
|
return this->EvaluateWithLanguage(parameters, context, content,
|
||||||
|
@ -479,8 +479,8 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
|
||||||
if (!context->HeadTarget)
|
if (!context->HeadTarget)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<CXX_COMPILER_ID> may only be used with targets. It may not "
|
"$<CXX_COMPILER_ID> may only be used with binary targets. It may "
|
||||||
"be used with add_custom_command.");
|
"not be used with add_custom_command or add_custom_target.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return this->EvaluateWithLanguage(parameters, context, content,
|
return this->EvaluateWithLanguage(parameters, context, content,
|
||||||
|
@ -541,8 +541,8 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
|
||||||
if (!context->HeadTarget)
|
if (!context->HeadTarget)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<C_COMPILER_VERSION> may only be used with targets. It may not "
|
"$<C_COMPILER_VERSION> may only be used with binary targets. It "
|
||||||
"be used with add_custom_command.");
|
"may not be used with add_custom_command or add_custom_target.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return this->EvaluateWithLanguage(parameters, context, content,
|
return this->EvaluateWithLanguage(parameters, context, content,
|
||||||
|
@ -563,8 +563,8 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
|
||||||
if (!context->HeadTarget)
|
if (!context->HeadTarget)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<CXX_COMPILER_VERSION> may only be used with targets. It may "
|
"$<CXX_COMPILER_VERSION> may only be used with binary targets. It "
|
||||||
"not be used with add_custom_command.");
|
"may not be used with add_custom_command or add_custom_target.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return this->EvaluateWithLanguage(parameters, context, content,
|
return this->EvaluateWithLanguage(parameters, context, content,
|
||||||
|
@ -893,10 +893,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
if (!target && parameters.size() == 1)
|
if (!target && parameters.size() == 1)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<TARGET_PROPERTY:prop> may only be used with targets. It may not "
|
"$<TARGET_PROPERTY:prop> may only be used with binary targets. "
|
||||||
"be used with add_custom_command. Specify the target to read a "
|
"It may not be used with add_custom_command or add_custom_target. "
|
||||||
"property from using the $<TARGET_PROPERTY:tgt,prop> signature "
|
"Specify the target to read a property from using the "
|
||||||
"instead.");
|
"$<TARGET_PROPERTY:tgt,prop> signature instead.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,8 +1460,8 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
|
||||||
if (!context->HeadTarget)
|
if (!context->HeadTarget)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"$<TARGET_POLICY:prop> may only be used with targets. It may not "
|
"$<TARGET_POLICY:prop> may only be used with binary targets. It "
|
||||||
"be used with add_custom_command.");
|
"may not be used with add_custom_command or add_custom_target.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,9 @@
|
||||||
|
CMake Error at NonValidTarget-CXX_COMPILER_ID.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<CXX_COMPILER_ID>
|
||||||
|
|
||||||
|
\$<CXX_COMPILER_ID> may only be used with binary targets. It may not be
|
||||||
|
used with add_custom_command or add_custom_target.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_ID>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,9 @@
|
||||||
|
CMake Error at NonValidTarget-CXX_COMPILER_VERSION.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<CXX_COMPILER_VERSION>
|
||||||
|
|
||||||
|
\$<CXX_COMPILER_VERSION> may only be used with binary targets. It may not
|
||||||
|
be used with add_custom_command or add_custom_target.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_VERSION>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,9 @@
|
||||||
|
CMake Error at NonValidTarget-C_COMPILER_ID.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<C_COMPILER_ID>
|
||||||
|
|
||||||
|
\$<C_COMPILER_ID> may only be used with binary targets. It may not be used
|
||||||
|
with add_custom_command or add_custom_target.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_ID>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,9 @@
|
||||||
|
CMake Error at NonValidTarget-C_COMPILER_VERSION.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<C_COMPILER_VERSION>
|
||||||
|
|
||||||
|
\$<C_COMPILER_VERSION> may only be used with binary targets. It may not be
|
||||||
|
used with add_custom_command or add_custom_target.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_VERSION>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,9 @@
|
||||||
|
CMake Error at NonValidTarget-TARGET_POLICY.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<TARGET_POLICY:CMP0004>
|
||||||
|
|
||||||
|
\$<TARGET_POLICY:prop> may only be used with binary targets. It may not be
|
||||||
|
used with add_custom_command or add_custom_target.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_POLICY:CMP0004>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,11 @@
|
||||||
|
CMake Error at NonValidTarget-TARGET_PROPERTY.cmake:4 \(add_custom_command\):
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<TARGET_PROPERTY:NotAProperty>
|
||||||
|
|
||||||
|
\$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not
|
||||||
|
be used with add_custom_command or add_custom_target. Specify the target
|
||||||
|
to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature
|
||||||
|
instead.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_PROPERTY:NotAProperty>.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp")
|
|
@ -10,3 +10,9 @@ run_cmake(BadTargetName)
|
||||||
run_cmake(BadTargetTypeObject)
|
run_cmake(BadTargetTypeObject)
|
||||||
run_cmake(BadInstallPrefix)
|
run_cmake(BadInstallPrefix)
|
||||||
run_cmake(CMP0044-WARN)
|
run_cmake(CMP0044-WARN)
|
||||||
|
run_cmake(NonValidTarget-C_COMPILER_ID)
|
||||||
|
run_cmake(NonValidTarget-CXX_COMPILER_ID)
|
||||||
|
run_cmake(NonValidTarget-C_COMPILER_VERSION)
|
||||||
|
run_cmake(NonValidTarget-CXX_COMPILER_VERSION)
|
||||||
|
run_cmake(NonValidTarget-TARGET_PROPERTY)
|
||||||
|
run_cmake(NonValidTarget-TARGET_POLICY)
|
||||||
|
|
Loading…
Reference in New Issue