ENH: Added install target implementation. Also added missing include of assert.h.

This commit is contained in:
Brad King 2005-01-04 18:24:52 -05:00
parent 79c67a6dfa
commit 4b48a89b96
2 changed files with 28 additions and 7 deletions

View File

@ -23,6 +23,8 @@
#include <queue>
#include <assert.h>
// Quick-switch for generating old makefiles.
#if 0
# define CMLUMG_MAKEFILE_NAME "Makefile"
@ -32,8 +34,9 @@
#endif
// TODO: Add "help" target.
// TODO: Add install targets to m_InstallTargets list.
// TODO: Identify remaining relative path violations.
// TODO: Add test to drive installation through native build system.
// TODO: Is there a case where quoted object list fails and unquoted works?
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator2::cmLocalUnixMakefileGenerator2()
@ -147,11 +150,6 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
"Build targets in this directory.",
m_BuildTargets);
// Write install rules.
this->WritePassRules(makefileStream, "install",
"Install files from this directory.",
m_InstallTargets);
// Write clean rules.
this->WritePassRules(makefileStream, "clean",
"Clean targets in this directory.",
@ -895,6 +893,30 @@ cmLocalUnixMakefileGenerator2
no_commands);
}
// Write special "install" target to run cmake_install.cmake script.
{
std::vector<std::string> no_depends;
std::vector<std::string> commands;
std::string cmd;
if(m_Makefile->GetDefinition("CMake_BINARY_DIR"))
{
// We are building CMake itself. We cannot use the original
// executable to install over itself.
cmd = m_ExecutableOutputPath;
cmd += "cmake";
cmd = this->ConvertToRelativeOutputPath(cmd.c_str());
}
else
{
cmd = "$(CMAKE_COMMAND)";
}
cmd += " -P cmake_install.cmake";
commands.push_back(cmd);
this->WriteMakeRule(makefileStream,
"Special rule to run installation script.", 0,
"install", no_depends, commands);
}
// Write special "rebuild_cache" target to re-run cmake.
{
std::vector<std::string> no_depends;

View File

@ -194,7 +194,6 @@ private:
// target rule file writing methods.
std::vector<std::string> m_DependTargets;
std::vector<std::string> m_BuildTargets;
std::vector<std::string> m_InstallTargets;
std::vector<std::string> m_CleanTargets;
// The prefix required of a path to be converted to a relative path.