1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGetSourceFilePropertyCommand.cxx,v $
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
&)
27 this->SetError("called with incorrect number of arguments");
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
);
41 if(args
[2] == "LANGUAGE")
43 this->Makefile
->AddDefinition(var
, sf
->GetLanguage());
46 const char *prop
= sf
->GetPropertyForUser(args
[2].c_str());
49 this->Makefile
->AddDefinition(var
, prop
);
54 this->Makefile
->AddDefinition(var
, "NOTFOUND");