STYLE: Fix typo in GetFilenameLastExtension docs
[cmake.git] / Source / cmIncludeExternalMSProjectCommand.cxx
blobdfbc45ee09277e37feaf1c33e991a405596246e2
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmIncludeExternalMSProjectCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-28 13:38:35 $
7 Version: $Revision: 1.23 $
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 "cmIncludeExternalMSProjectCommand.h"
19 // cmIncludeExternalMSProjectCommand
20 bool cmIncludeExternalMSProjectCommand
21 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 if(args.size() < 2)
25 this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
26 "number of arguments");
27 return false;
29 // only compile this for win32 to avoid coverage errors
30 #ifdef _WIN32
31 if(this->Makefile->GetDefinition("WIN32"))
33 std::string location = args[1];
35 std::vector<std::string> depends;
36 if (args.size() > 2)
38 for (unsigned int i=2; i<args.size(); ++i)
40 depends.push_back(args[i]);
44 // Hack together a utility target storing enough information
45 // to reproduce the target inclusion.
46 std::string utility_name("INCLUDE_EXTERNAL_MSPROJECT");
47 utility_name += "_";
48 utility_name += args[0];
49 std::string path = args[1];
50 cmSystemTools::ConvertToUnixSlashes(path);
52 // Create a target instance for this utility.
53 cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY,
54 utility_name.c_str());
55 target->SetProperty("EXCLUDE_FROM_ALL","FALSE");
56 std::vector<std::string> no_outputs;
57 cmCustomCommandLines commandLines;
58 cmCustomCommandLine commandLine;
59 commandLine.push_back(args[0]);
60 commandLine.push_back(path);
61 commandLines.push_back(commandLine);
62 cmCustomCommand cc(no_outputs, depends, commandLines, 0, 0);
63 target->GetPostBuildCommands().push_back(cc);
65 #endif
66 return true;