1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExportCommand.h,v $
6 Date: $Date: 2009-09-01 18:04:53 $
7 Version: $Revision: 1.10 $
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 #ifndef cmExportCommand_h
18 #define cmExportCommand_h
20 #include "cmCommand.h"
22 class cmExportBuildFileGenerator
;
24 /** \class cmExportLibraryDependenciesCommand
25 * \brief Add a test to the lists of tests to run.
27 * cmExportLibraryDependenciesCommand adds a test to the list of tests to run
30 class cmExportCommand
: public cmCommand
35 * This is a virtual constructor for the command.
37 virtual cmCommand
* Clone()
39 return new cmExportCommand
;
43 * This is called when the command is first encountered in
44 * the CMakeLists.txt file.
46 virtual bool InitialPass(std::vector
<std::string
> const& args
,
47 cmExecutionStatus
&status
);
50 * The name of the command as specified in CMakeList.txt.
52 virtual const char* GetName() { return "export";}
55 * Succinct documentation.
57 virtual const char* GetTerseDocumentation()
60 "Export targets from the build tree for use by outside projects.";
66 virtual const char* GetFullDocumentation()
69 " export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]\n"
70 " [APPEND] FILE <filename>)\n"
71 "Create a file <filename> that may be included by outside projects to "
72 "import targets from the current project's build tree. "
73 "This is useful during cross-compiling to build utility executables "
74 "that can run on the host platform in one project and then import "
75 "them into another project being compiled for the target platform. "
76 "If the NAMESPACE option is given the <namespace> string will be "
77 "prepended to all target names written to the file. "
78 "If the APPEND option is given the generated code will be appended "
79 "to the file instead of overwriting it. "
80 "If a library target is included in the export but "
81 "a target to which it links is not included the behavior is "
84 "The file created by this command is specific to the build tree and "
85 "should never be installed. "
86 "See the install(EXPORT) command to export targets from an "
89 " export(PACKAGE <name>)\n"
90 "Store the current build directory in the CMake user package registry "
91 "for package <name>. "
92 "The find_package command may consider the directory while searching "
93 "for package <name>. "
94 "This helps dependent projects find and use a package from the "
95 "current project's build tree without help from the user. "
96 "Note that the entry in the package registry that this command "
97 "creates works only in conjunction with a package configuration "
98 "file (<name>Config.cmake) that works with the build tree."
102 cmTypeMacro(cmExportCommand
, cmCommand
);
105 cmCommandArgumentGroup ArgumentGroup
;
106 cmCAStringVector Targets
;
108 cmCAString Namespace
;
111 friend class cmExportBuildFileGenerator
;
112 std::string ErrorMessage
;
114 bool HandlePackage(std::vector
<std::string
> const& args
);
115 void StorePackageRegistryWin(std::string
const& package
,
116 const char* content
, const char* hash
);
117 void StorePackageRegistryDir(std::string
const& package
,
118 const char* content
, const char* hash
);
119 void ReportRegistryError(std::string
const& msg
, std::string
const& key
,