diff options
author | Brad King <brad.king@kitware.com> | 2007-03-08 19:57:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-03-08 19:57:28 (GMT) |
commit | 33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d (patch) | |
tree | 5f2f82863c856ed2f5c1f04158eb228ac1477c24 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | ea19994b13273cf6e1f7677cc29ce53cf1a59768 (diff) | |
download | CMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.zip CMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.tar.gz CMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.tar.bz2 |
ENH: Replaced LibraryOutputPath and ExecutableOutputPath variables in Makefile and VS generators to instead ask each target for its output path. This significantly reduces total code size and centralizes previously duplicate code. It is also a step towards bug#2240.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 73 |
1 files changed, 11 insertions, 62 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9869977..365ce56 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -78,8 +78,17 @@ void cmLocalUnixMakefileGenerator3::Configure() //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::Generate() { - // Setup our configuration variables for this directory. - this->ConfigureOutputPaths(); + // Store the configuration name that will be generated. + if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) + { + // Use the build type given by the user. + this->ConfigurationName = config; + } + else + { + // No configuration type given. + this->ConfigurationName = ""; + } // Record whether some options are enabled to avoid checking many // times later. @@ -182,66 +191,6 @@ void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable() } //---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::ConfigureOutputPaths() -{ - // Format the library and executable output paths. - if(const char* libOut = - this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH")) - { - this->LibraryOutputPath = libOut; - this->FormatOutputPath(this->LibraryOutputPath, "LIBRARY"); - } - if(const char* exeOut = - this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) - { - this->ExecutableOutputPath = exeOut; - this->FormatOutputPath(this->ExecutableOutputPath, "EXECUTABLE"); - } - - // Store the configuration name that will be generated. - if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) - { - // Use the build type given by the user. - this->ConfigurationName = config; - } - else - { - // No configuration type given. - this->ConfigurationName = ""; - } -} - -//---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::FormatOutputPath(std::string& path, - const char* name) -{ - if(!path.empty()) - { - // Convert the output path to a full path in case it is - // specified as a relative path. Treat a relative path as - // relative to the current output directory for this makefile. - path = cmSystemTools::CollapseFullPath - (path.c_str(), this->Makefile->GetStartOutputDirectory()); - - // Add a trailing slash for easy appending later. - if(path.empty() || path[path.size()-1] != '/') - { - path += "/"; - } - - // Make sure the output path exists on disk. - if(!cmSystemTools::MakeDirectory(path.c_str())) - { - cmSystemTools::Error("Error failed to create ", - name, "_OUTPUT_PATH directory:", path.c_str()); - } - - // Add this as a link directory automatically. - this->Makefile->AddLinkDirectory(path.c_str()); - } -} - -//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() { // generate the includes |