Clarify documentation for if.
[cmake.git] / Source / cmBuildCommand.cxx
blob0482bab8ec2698f1be17607224bd15f0839f0713
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmBuildCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.24 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmBuildCommand.h"
19 #include "cmLocalGenerator.h"
20 #include "cmGlobalGenerator.h"
22 // cmBuildCommand
23 bool cmBuildCommand
24 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
26 if(args.size() < 2 )
28 this->SetError("called with incorrect number of arguments");
29 return false;
31 const char* define = args[0].c_str();
32 const char* cacheValue
33 = this->Makefile->GetDefinition(define);
34 std::string makeprogram = args[1];
35 std::string configType = "Release";
36 const char* cfg = getenv("CMAKE_CONFIG_TYPE");
37 if ( cfg )
39 configType = cfg;
41 std::string makecommand = this->Makefile->GetLocalGenerator()
42 ->GetGlobalGenerator()->GenerateBuildCommand
43 (makeprogram.c_str(), this->Makefile->GetProjectName(), 0,
44 0, configType.c_str(), true, false);
46 if(cacheValue)
48 return true;
50 this->Makefile->AddCacheDefinition(define,
51 makecommand.c_str(),
52 "Command used to build entire project "
53 "from the command line.",
54 cmCacheManager::STRING);
55 return true;