diff options
author | Brad King <brad.king@kitware.com> | 2001-08-14 21:18:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2001-08-14 21:18:52 (GMT) |
commit | 3d86ad7237b525f96fe56ebc5767926546daf591 (patch) | |
tree | 2c313c430c1c200b41d5918f3faf382b5ed2f62e /Source/cmInstallProgramsCommand.cxx | |
parent | 7d2410097ef261013549a0b023b1588fe28043ee (diff) | |
download | CMake-3d86ad7237b525f96fe56ebc5767926546daf591.zip CMake-3d86ad7237b525f96fe56ebc5767926546daf591.tar.gz CMake-3d86ad7237b525f96fe56ebc5767926546daf591.tar.bz2 |
ENH: Improved INSTALL_FILES and INSTALL_PROGRAMS commands to allow each call to the command in a single directory to specify a different install path.
Diffstat (limited to 'Source/cmInstallProgramsCommand.cxx')
-rw-r--r-- | Source/cmInstallProgramsCommand.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index e8fac31..657691b 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -50,29 +50,27 @@ bool cmInstallProgramsCommand::InitialPass(std::vector<std::string>& args) return false; } - cmTargets &tgts = m_Makefile->GetTargets(); + // Create an INSTALL_PROGRAMS target specifically for this path. + m_TargetName = "INSTALL_PROGRAMS_"+args[0]; + cmTarget target; + target.SetInAll(false); + target.SetType(cmTarget::INSTALL_PROGRAMS); + target.SetInstallPath(args[0].c_str()); + m_Makefile->GetTargets().insert(cmTargets::value_type(m_TargetName, target)); + std::vector<std::string>::iterator s = args.begin(); - if (tgts.find("INSTALL_PROGRAMS") != tgts.end()) - { - tgts["INSTALL_PROGRAMS"].SetInstallPath(args[0].c_str()); - } - ++s; - for (;s != args.end(); ++s) + for (++s;s != args.end(); ++s) { m_FinalArgs.push_back(*s); - } + } return true; } void cmInstallProgramsCommand::FinalPass() { - cmTargets &tgts = m_Makefile->GetTargets(); - - if (tgts.find("INSTALL_PROGRAMS") == tgts.end()) - { - return; - } + std::vector<std::string>& targetSourceLists = + m_Makefile->GetTargets()[m_TargetName].GetSourceLists(); // two different options if (m_FinalArgs.size() > 1) @@ -85,7 +83,7 @@ void cmInstallProgramsCommand::FinalPass() std::string temps = *s; m_Makefile->ExpandVariablesInString(temps); // add to the result - tgts["INSTALL_PROGRAMS"].GetSourceLists().push_back(temps); + targetSourceLists.push_back(temps); } } else // reg exp list @@ -98,7 +96,7 @@ void cmInstallProgramsCommand::FinalPass() // for each argument, get the programs for (;s != programs.end(); ++s) { - tgts["INSTALL_PROGRAMS"].GetSourceLists().push_back(*s); + targetSourceLists.push_back(*s); } } } |