mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
@@ -1734,8 +1734,10 @@ Export And Install Expressions
|
||||
|
||||
Content of the install prefix when the target is exported via
|
||||
:command:`install(EXPORT)`, or when evaluated in the
|
||||
:prop_tgt:`INSTALL_NAME_DIR` property or the ``INSTALL_NAME_DIR`` argument of
|
||||
:command:`install(RUNTIME_DEPENDENCY_SET)`, and empty otherwise.
|
||||
:prop_tgt:`INSTALL_NAME_DIR` property, the ``INSTALL_NAME_DIR`` argument of
|
||||
:command:`install(RUNTIME_DEPENDENCY_SET)`, the code argument of
|
||||
:command:`install(CODE)`, or the file argument of :command:`install(SCRIPT)`,
|
||||
and empty otherwise.
|
||||
|
||||
Multi-level Expression Evaluation
|
||||
---------------------------------
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
install-prefix-genex-install-code-script
|
||||
----------------------------------------
|
||||
|
||||
* The :command:`install(CODE)` and :command:`install(SCRIPT)` commands
|
||||
now support the :genex:`$<INSTALL_PREFIX>` generator expression.
|
||||
@@ -359,13 +359,15 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
} else if (doing_script) {
|
||||
doing_script = false;
|
||||
std::string script = arg;
|
||||
if (!cmSystemTools::FileIsFullPath(script)) {
|
||||
script =
|
||||
cmStrCat(helper.Makefile->GetCurrentSourceDirectory(), '/', arg);
|
||||
}
|
||||
if (cmSystemTools::FileIsDirectory(script)) {
|
||||
status.SetError("given a directory as value of SCRIPT argument.");
|
||||
return false;
|
||||
if (!cmHasLiteralPrefix(script, "$<INSTALL_PREFIX>")) {
|
||||
if (!cmSystemTools::FileIsFullPath(script)) {
|
||||
script =
|
||||
cmStrCat(helper.Makefile->GetCurrentSourceDirectory(), '/', arg);
|
||||
}
|
||||
if (cmSystemTools::FileIsDirectory(script)) {
|
||||
status.SetError("given a directory as value of SCRIPT argument.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallScriptGenerator>(
|
||||
|
||||
@@ -56,12 +56,12 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
|
||||
std::string cmInstallScriptGenerator::GetScript(
|
||||
std::string const& config) const
|
||||
{
|
||||
std::string script;
|
||||
std::string script = this->Script;
|
||||
if (this->AllowGenex && this->ActionsPerConfig) {
|
||||
script = cmGeneratorExpression::Evaluate(this->Script,
|
||||
this->LocalGenerator, config);
|
||||
} else {
|
||||
script = this->Script;
|
||||
cmGeneratorExpression::ReplaceInstallPrefix(script,
|
||||
"${CMAKE_INSTALL_PREFIX}");
|
||||
script =
|
||||
cmGeneratorExpression::Evaluate(script, this->LocalGenerator, config);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ unset(RunCMake_TEST_OPTIONS)
|
||||
|
||||
run_install_test(Deprecated)
|
||||
run_install_test(PRE_POST_INSTALL_SCRIPT)
|
||||
run_install_test(SCRIPT)
|
||||
run_install_test(TARGETS-CONFIGURATIONS)
|
||||
run_install_test(DIRECTORY-PATTERN)
|
||||
run_install_test(TARGETS-Parts)
|
||||
@@ -174,6 +173,10 @@ run_install_test(FILES-PERMISSIONS)
|
||||
run_install_test(TARGETS-RPATH)
|
||||
run_install_test(InstallRequiredSystemLibraries)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_POLICY_DEFAULT_CMP0087:STRING=NEW")
|
||||
run_install_test(SCRIPT)
|
||||
unset(RunCMake_TEST_OPTIONS)
|
||||
|
||||
if(UNIX)
|
||||
run_install_test(DIRECTORY-symlink-clobber)
|
||||
endif()
|
||||
|
||||
@@ -1 +1 @@
|
||||
check_installed([[^empty1.txt;empty2.txt$]])
|
||||
check_installed([[^empty1.txt;empty2.txt;empty3.cmake;empty3.txt;empty4.cmake;empty4.txt$]])
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/empty3.cmake ${CMAKE_CURRENT_SOURCE_DIR}/empty4.cmake
|
||||
DESTINATION .
|
||||
)
|
||||
install(
|
||||
SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
|
||||
CODE "write_empty_file(empty2.txt)"
|
||||
SCRIPT "$<INSTALL_PREFIX>/empty3.cmake"
|
||||
CODE [[include($<INSTALL_PREFIX>/empty4.cmake)]]
|
||||
)
|
||||
|
||||
1
Tests/RunCMake/install/empty3.cmake
Normal file
1
Tests/RunCMake/install/empty3.cmake
Normal file
@@ -0,0 +1 @@
|
||||
write_empty_file(empty3.txt)
|
||||
1
Tests/RunCMake/install/empty4.cmake
Normal file
1
Tests/RunCMake/install/empty4.cmake
Normal file
@@ -0,0 +1 @@
|
||||
write_empty_file(empty4.txt)
|
||||
Reference in New Issue
Block a user