Clarify documentation for if.
[cmake.git] / Source / cmGetSourceFilePropertyCommand.cxx
blob5848b9ee0eefb9f46a748120bb923f8a8908d21e
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGetSourceFilePropertyCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-30 16:21:54 $
7 Version: $Revision: 1.14 $
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 "cmGetSourceFilePropertyCommand.h"
19 #include "cmSourceFile.h"
21 // cmSetSourceFilePropertyCommand
22 bool cmGetSourceFilePropertyCommand
23 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
25 if(args.size() != 3 )
27 this->SetError("called with incorrect number of arguments");
28 return false;
30 const char* var = args[0].c_str();
31 const char* file = args[1].c_str();
32 cmSourceFile* sf = this->Makefile->GetSource(file);
34 // for the location we must create a source file first
35 if (!sf && args[2] == "LOCATION")
37 sf = this->Makefile->GetOrCreateSource(file);
39 if(sf)
41 if(args[2] == "LANGUAGE")
43 this->Makefile->AddDefinition(var, sf->GetLanguage());
44 return true;
46 const char *prop = sf->GetPropertyForUser(args[2].c_str());
47 if (prop)
49 this->Makefile->AddDefinition(var, prop);
50 return true;
54 this->Makefile->AddDefinition(var, "NOTFOUND");
55 return true;