~ubuntu-branches/ubuntu/breezy/cmake/breezy

« back to all changes in this revision

Viewing changes to Source/cmProjectCommand.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Maitland Bottoms
  • Date: 2002-02-14 18:36:25 UTC
  • Revision ID: james.westby@ubuntu.com-20020214183625-8m44isdas2k4l0f7
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   Insight Segmentation & Registration Toolkit
 
4
  Module:    $RCSfile: cmProjectCommand.cxx,v $
 
5
  Language:  C++
 
6
  Date:      $Date: 2001/10/17 19:11:02 $
 
7
  Version:   $Revision: 1.10 $
 
8
 
 
9
Copyright (c) 2001 Insight Consortium
 
10
All rights reserved.
 
11
 
 
12
Redistribution and use in source and binary forms, with or without
 
13
modification, are permitted provided that the following conditions are met:
 
14
 
 
15
 * Redistributions of source code must retain the above copyright notice,
 
16
   this list of conditions and the following disclaimer.
 
17
 
 
18
 * Redistributions in binary form must reproduce the above copyright notice,
 
19
   this list of conditions and the following disclaimer in the documentation
 
20
   and/or other materials provided with the distribution.
 
21
 
 
22
 * The name of the Insight Consortium, nor the names of any consortium members,
 
23
   nor of any contributors, may be used to endorse or promote products derived
 
24
   from this software without specific prior written permission.
 
25
 
 
26
  * Modified source versions must be plainly marked as such, and must not be
 
27
    misrepresented as being the original software.
 
28
 
 
29
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
 
30
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
31
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
32
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
 
33
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
34
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
35
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
36
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
37
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
38
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
39
 
 
40
=========================================================================*/
 
41
#include "cmProjectCommand.h"
 
42
 
 
43
// cmProjectCommand
 
44
bool cmProjectCommand::InitialPass(std::vector<std::string> const& args)
 
45
{
 
46
  if(args.size() < 1 || args.size() > 1)
 
47
    {
 
48
    this->SetError("PROJECT called with incorrect number of arguments");
 
49
    return false;
 
50
    }
 
51
  m_Makefile->SetProjectName(args[0].c_str());
 
52
 
 
53
  std::string bindir = args[0];
 
54
  bindir += "_BINARY_DIR";
 
55
  std::string srcdir = args[0];
 
56
  srcdir += "_SOURCE_DIR";
 
57
  
 
58
  m_Makefile->AddCacheDefinition(bindir.c_str(),
 
59
                                 m_Makefile->GetCurrentOutputDirectory(),
 
60
                                 "Value Computed by CMake", cmCacheManager::STATIC);
 
61
  m_Makefile->AddCacheDefinition(srcdir.c_str(),
 
62
                                 m_Makefile->GetCurrentDirectory(),
 
63
                                 "Value Computed by CMake", cmCacheManager::STATIC);
 
64
  
 
65
  bindir = "PROJECT_BINARY_DIR";
 
66
  srcdir = "PROJECT_SOURCE_DIR";
 
67
 
 
68
  m_Makefile->AddDefinition(bindir.c_str(),
 
69
          m_Makefile->GetCurrentOutputDirectory());
 
70
  m_Makefile->AddDefinition(srcdir.c_str(),
 
71
          m_Makefile->GetCurrentDirectory());
 
72
 
 
73
  m_Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
 
74
 
 
75
  return true;
 
76
}
 
77