1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmIncludeExternalMSProjectCommand.cxx,v $
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
&)
25 this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
26 "number of arguments");
29 // only compile this for win32 to avoid coverage errors
31 if(this->Makefile
->GetDefinition("WIN32"))
33 std::string location
= args
[1];
35 std::vector
<std::string
> depends
;
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");
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
);