diff options
author | Dāvis Mosāns <davispuh@gmail.com> | 2016-07-07 21:54:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-07-18 13:51:01 (GMT) |
commit | b1f87a50b3aee129d420b8d789ebec55068e4ec5 (patch) | |
tree | e9223617c45d01c60a4c89c5d60dc0121a75a989 /Source/cmBuildCommand.cxx | |
parent | 03407040d4d7d89fbb45e941a9dfb4257003a8a8 (diff) | |
download | CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.zip CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.gz CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.bz2 |
Use better KWSys SystemTools::GetEnv and HasEnv signatures
Diffstat (limited to 'Source/cmBuildCommand.cxx')
-rw-r--r-- | Source/cmBuildCommand.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index fb143a2..9830867 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -36,8 +36,8 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args) const char* variable = args[0].c_str(); // Parse remaining arguments. - const char* configuration = CM_NULLPTR; - const char* project_name = CM_NULLPTR; + std::string configuration; + std::string project_name; std::string target; enum Doing { @@ -56,10 +56,10 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args) doing = DoingTarget; } else if (doing == DoingConfiguration) { doing = DoingNone; - configuration = args[i].c_str(); + configuration = args[i]; } else if (doing == DoingProjectName) { doing = DoingNone; - project_name = args[i].c_str(); + project_name = args[i]; } else if (doing == DoingTarget) { doing = DoingNone; target = args[i]; @@ -76,14 +76,14 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args) // so we put this code here to end up with the same default configuration // as the original 2-arg build_command signature: // - if (!configuration || !*configuration) { - configuration = getenv("CMAKE_CONFIG_TYPE"); + if (configuration.empty()) { + cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configuration); } - if (!configuration || !*configuration) { + if (configuration.empty()) { configuration = "Release"; } - if (project_name && *project_name) { + if (!project_name.empty()) { this->Makefile->IssueMessage( cmake::AUTHOR_WARNING, "Ignoring PROJECT_NAME option because it has no effect."); @@ -91,7 +91,8 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args) std::string makecommand = this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand( - target, configuration, "", this->Makefile->IgnoreErrorsCMP0061()); + target, configuration.c_str(), "", + this->Makefile->IgnoreErrorsCMP0061()); this->Makefile->AddDefinition(variable, makecommand.c_str()); @@ -108,10 +109,10 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args) const char* define = args[0].c_str(); const char* cacheValue = this->Makefile->GetDefinition(define); - std::string configType = "Release"; - const char* cfg = getenv("CMAKE_CONFIG_TYPE"); - if (cfg && *cfg) { - configType = cfg; + std::string configType; + if (!cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configType) || + configType.empty()) { + configType = "Release"; } std::string makecommand = |