Make it an error for INSTALL_PREFIX to be evaluated.
An empty string is not likely going to produce expected results in any evaluation context. It is replaced by preprocessing currently.
This commit is contained in:
parent
7ceeba992b
commit
df4d2b28b2
|
@ -621,14 +621,17 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
|
|||
{
|
||||
InstallPrefixNode() {}
|
||||
|
||||
virtual bool GeneratesContent() const { return false; }
|
||||
virtual bool GeneratesContent() const { return true; }
|
||||
virtual int NumExpectedParameters() const { return 0; }
|
||||
|
||||
std::string Evaluate(const std::vector<std::string> &,
|
||||
cmGeneratorExpressionContext *,
|
||||
const GeneratorExpressionContent *,
|
||||
cmGeneratorExpressionContext *context,
|
||||
const GeneratorExpressionContent *content,
|
||||
cmGeneratorExpressionDAGChecker *) const
|
||||
{
|
||||
reportError(context, content->GetOriginalExpression(),
|
||||
"INSTALL_PREFIX is a marker for install(EXPORT) only. It "
|
||||
"should never be evaluated.");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ add_custom_target(check-part2 ALL
|
|||
-Dtest_install_interface=$<INSTALL_INTERFACE:install>
|
||||
-Dtest_target_name_1=$<TARGET_NAME:tgt,ok>
|
||||
-Dtest_target_name_2=$<TARGET_NAME:tgt:ok>
|
||||
-Dtest_install_prefix=$<INSTALL_PREFIX>
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)"
|
||||
VERBATIM
|
||||
|
|
|
@ -26,4 +26,3 @@ check(test_build_interface "build")
|
|||
check(test_install_interface "")
|
||||
check(test_target_name_1 "tgt,ok")
|
||||
check(test_target_name_2 "tgt:ok")
|
||||
check(test_install_prefix "")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,9 @@
|
|||
CMake Error at BadInstallPrefix.cmake:1 \(add_custom_target\):
|
||||
Error evaluating generator expression:
|
||||
|
||||
\$<INSTALL_PREFIX>
|
||||
|
||||
INSTALL_PREFIX is a marker for install\(EXPORT\) only. It should never be
|
||||
evaluated.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,3 @@
|
|||
add_custom_target(check ALL COMMAND check
|
||||
$<INSTALL_PREFIX>/include
|
||||
VERBATIM)
|
|
@ -7,3 +7,4 @@ run_cmake(BadNOT)
|
|||
run_cmake(BadStrEqual)
|
||||
run_cmake(BadZero)
|
||||
run_cmake(BadTargetName)
|
||||
run_cmake(BadInstallPrefix)
|
||||
|
|
Loading…
Reference in New Issue