From 4b48a89b967ef62e611184f1e750d60777279683 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Jan 2005 18:24:52 -0500 Subject: [PATCH] ENH: Added install target implementation. Also added missing include of assert.h. --- Source/cmLocalUnixMakefileGenerator2.cxx | 34 +++++++++++++++++++----- Source/cmLocalUnixMakefileGenerator2.h | 1 - 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx index 9168fd246a..99acf28e77 100644 --- a/Source/cmLocalUnixMakefileGenerator2.cxx +++ b/Source/cmLocalUnixMakefileGenerator2.cxx @@ -23,6 +23,8 @@ #include +#include + // 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 no_depends; + std::vector 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 no_depends; diff --git a/Source/cmLocalUnixMakefileGenerator2.h b/Source/cmLocalUnixMakefileGenerator2.h index 64b3b805e9..5f831a0d2a 100644 --- a/Source/cmLocalUnixMakefileGenerator2.h +++ b/Source/cmLocalUnixMakefileGenerator2.h @@ -194,7 +194,6 @@ private: // target rule file writing methods. std::vector m_DependTargets; std::vector m_BuildTargets; - std::vector m_InstallTargets; std::vector m_CleanTargets; // The prefix required of a path to be converted to a relative path.