FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmProjectCommand.cxx
blob6a52762c4def4d9da663b81daefca494838815d1
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmProjectCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-04-05 17:08:12 $
7 Version: $Revision: 1.14 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmProjectCommand.h"
19 // cmProjectCommand
20 bool cmProjectCommand::InitialPass(std::vector<std::string> const& argsIn)
22 if(argsIn.size() < 1 )
24 this->SetError("PROJECT called with incorrect number of arguments");
25 return false;
27 std::vector<std::string> args;
28 cmSystemTools::ExpandListArguments(argsIn, args);
29 m_Makefile->SetProjectName(args[0].c_str());
31 std::string bindir = args[0];
32 bindir += "_BINARY_DIR";
33 std::string srcdir = args[0];
34 srcdir += "_SOURCE_DIR";
36 m_Makefile->AddCacheDefinition(bindir.c_str(),
37 m_Makefile->GetCurrentOutputDirectory(),
38 "Value Computed by CMake", cmCacheManager::STATIC);
39 m_Makefile->AddCacheDefinition(srcdir.c_str(),
40 m_Makefile->GetCurrentDirectory(),
41 "Value Computed by CMake", cmCacheManager::STATIC);
43 bindir = "PROJECT_BINARY_DIR";
44 srcdir = "PROJECT_SOURCE_DIR";
46 m_Makefile->AddDefinition(bindir.c_str(),
47 m_Makefile->GetCurrentOutputDirectory());
48 m_Makefile->AddDefinition(srcdir.c_str(),
49 m_Makefile->GetCurrentDirectory());
51 m_Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
53 if(args.size() > 1)
55 for(size_t i =1; i < args.size(); ++i)
57 m_Makefile->EnableLanguage(args[i].c_str());
60 else
62 m_Makefile->EnableLanguage(0);
64 return true;