[Cmake-commits] CMake branch, next, updated. v2.8.12.1-6388-g39f50a3
Stephen Kelly
steveire at gmail.com
Tue Dec 24 07:04:15 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 39f50a366013c66abbd7791696a89b416ee8ef5d (commit)
via 98b9f52bc90e96618445785bfd6af777b9dc11bc (commit)
via a1d2bda23e9fb2bc463b3ff5b57f1f88edfd40ca (commit)
via f4f6529354a2e551626fb77e22624cf180baa9b0 (commit)
via cbe7e8fae48b3663e784bb37d5f66bf8b3eb0546 (commit)
from 8adad3213dedbec0722888d7df9b0c8a6fdb9798 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=39f50a366013c66abbd7791696a89b416ee8ef5d
commit 39f50a366013c66abbd7791696a89b416ee8ef5d
Merge: 8adad32 98b9f52
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 24 07:04:07 2013 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 24 07:04:07 2013 -0500
Merge topic 'export-EXPORT-subcommand' into next
98b9f52 Help: Document export(EXPORT) in the cmake-packages manual.
a1d2bda Don't copy find_dependency in configure_package_config_file.
f4f6529 Help: cmake-packages: Add missing slash.
cbe7e8f export: Implement EXPORT subcommand (#9822)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98b9f52bc90e96618445785bfd6af777b9dc11bc
commit 98b9f52bc90e96618445785bfd6af777b9dc11bc
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 23 16:45:45 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Dec 24 13:02:49 2013 +0100
Help: Document export(EXPORT) in the cmake-packages manual.
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index 1ca661e..dc301ba 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -266,6 +266,7 @@ shared library:
project(UpstreamLib)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(Upstream_VERSION 3.4.1)
@@ -292,11 +293,20 @@ shared library:
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
- "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStatsConfigVersion.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake"
VERSION ${Upstream_VERSION}
COMPATIBILITY AnyNewerVersion
)
+ export(EXPORT ClimbingStatsTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsTargets.cmake"
+ NAMESPACE Upstream::
+ )
+ configure_file(cmake/ClimbingStatsConfig.cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake"
+ COPY_ONLY
+ )
+
set(ConfigPackageLocation lib/cmake/ClimbingStats)
install(EXPORT ClimbingStatsTargets
FILE
@@ -309,7 +319,7 @@ shared library:
install(
FILES
cmake/ClimbingStatsConfig.cmake
- "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStatsConfigVersion.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake"
DESTINATION
${ConfigPackageLocation}
COMPONENT
@@ -354,6 +364,14 @@ should be provided by the ``ClimbingStats`` package, they should
be in a separate file which is installed to the same location as the
``ClimbingStatsConfig.cmake`` file, and included from there.
+The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets
+definition file which is specific to the build-tree. This can similiarly be
+used with a suitable package configuration file and package version file to
+define a package for the build tree which may be used without installation.
+Consumers of the build tree can simply ensure that the
+:variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the
+``ClimbingStats_DIR`` to ``<build_dir>/ClimbingStats`` in the cache.
+
This can also be extended to cover dependencies:
.. code-block:: cmake
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1d2bda23e9fb2bc463b3ff5b57f1f88edfd40ca
commit a1d2bda23e9fb2bc463b3ff5b57f1f88edfd40ca
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 24 01:15:42 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Dec 24 13:02:49 2013 +0100
Don't copy find_dependency in configure_package_config_file.
There is not really any need to. Downstreams can either rely on it
being provided by CMake, or copy and distribute it.
Change the documented include for the find_dependency macro.
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index 23a8b68..1ca661e 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -375,7 +375,7 @@ dependencies of a package should be found in the ``Config.cmake`` file:
.. code-block:: cmake
- include(CMakePackageConfigHelpers)
+ include(CMakeFindDependencyMacro)
find_dependency(Stats 2.6.4)
include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
@@ -392,7 +392,7 @@ be true. This can be tested with logic in the package configuration file:
.. code-block:: cmake
- include(CMakePackageConfigHelpers)
+ include(CMakeFindDependencyMacro)
find_dependency(Stats 2.6.4)
include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 2c1c613..f388fe0 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -11,8 +11,7 @@
# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
# [PATH_VARS <var1> <var2> ... <varN>]
# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
-# [NO_FIND_DEPENDENCY_MACRO])
+# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
#
#
#
@@ -196,7 +195,6 @@
include(CMakeParseArguments)
include(WriteBasicConfigVersionFile)
-include(CMakeFindDependencyMacro)
macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
write_basic_config_version_file(${ARGN})
@@ -205,7 +203,7 @@ endmacro()
set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR})
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
- set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO)
+ set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
set(oneValueArgs INSTALL_DESTINATION )
set(multiValueArgs PATH_VARS )
@@ -291,11 +289,6 @@ endmacro()
")
endif()
- if(NOT CCF_NO_FIND_DEPENDENCY_MACRO)
- file(READ "${cfpch_dir}/CMakeFindDependencyMacro.cmake" find_dependency_macro)
- set(PACKAGE_INIT "${PACKAGE_INIT} ${find_dependency_macro}")
- endif()
-
set(PACKAGE_INIT "${PACKAGE_INIT}
####################################################################################")
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4f6529354a2e551626fb77e22624cf180baa9b0
commit f4f6529354a2e551626fb77e22624cf180baa9b0
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 24 01:14:10 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Dec 24 13:02:49 2013 +0100
Help: cmake-packages: Add missing slash.
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index 952da3c..23a8b68 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -405,7 +405,7 @@ be true. This can be tested with logic in the package configuration file:
set(ClimbingStats_FOUND False)
set(ClimbingStats_NOTFOUND_MESSAGE "Specified unsupported component: ${_comp}")
endif()
- include("${CMAKE_CURRENT_LIST_DIR}ClimbingStats${_comp}Targets.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake")
endforeach()
Here, the ``ClimbingStats_NOTFOUND_MESSAGE`` is set to a diagnosis that the package
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbe7e8fae48b3663e784bb37d5f66bf8b3eb0546
commit cbe7e8fae48b3663e784bb37d5f66bf8b3eb0546
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 23 17:07:26 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Dec 24 13:02:49 2013 +0100
export: Implement EXPORT subcommand (#9822)
Teach the export command to handle export sets defined by invocations
of install(TARGETS ... EXPORT foo). This makes maintenance of targets
exported to both the build tree and install tree trivial.
diff --git a/Help/command/export.rst b/Help/command/export.rst
index c293340..6b83587 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -5,8 +5,7 @@ Export targets from the build tree for use by outside projects.
::
- export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
- [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
+ export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
Create a file <filename> that may be included by outside projects to
import targets from the current project's build tree. This is useful
@@ -14,14 +13,10 @@ during cross-compiling to build utility executables that can run on
the host platform in one project and then import them into another
project being compiled for the target platform. If the NAMESPACE
option is given the <namespace> string will be prepended to all target
-names written to the file. If the APPEND option is given the
-generated code will be appended to the file instead of overwriting it.
-The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the
-contents of the properties matching
-``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
-policy CMP0022 is NEW. If a library target is included in the export
-but a target to which it links is not included the behavior is
-unspecified.
+names written to the file.
+
+Target installations are associated with the export <export-name>
+using the ``EXPORT`` option of the :command:`install(TARGETS)` command.
The file created by this command is specific to the build tree and
should never be installed. See the install(EXPORT) command to export
@@ -32,6 +27,21 @@ same values as the final values of the input TARGETS.
::
+ export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
+ [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
+
+This signature is similar to the ``EXPORT`` signature, but targets are listed
+explicitly rather than specified as an export-name. If the APPEND option is
+given the generated code will be appended to the file instead of overwriting it.
+The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the
+contents of the properties matching
+``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
+policy CMP0022 is NEW. If a library target is included in the export
+but a target to which it links is not included the behavior is
+unspecified.
+
+::
+
export(PACKAGE <name>)
Store the current build directory in the CMake user package registry
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index c10f86f..b669cd1 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -13,11 +13,14 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
+#include "cmExportSet.h"
+#include "cmTargetExport.h"
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
{
this->Makefile = 0;
+ this->ExportSet = 0;
}
//----------------------------------------------------------------------------
@@ -26,9 +29,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{
std::string expectedTargets;
std::string sep;
+ std::vector<std::string> targets;
+ this->GetTargets(targets);
for(std::vector<std::string>::const_iterator
- tei = this->Targets.begin();
- tei != this->Targets.end(); ++tei)
+ tei = targets.begin();
+ tei != targets.end(); ++tei)
{
cmTarget *te = this->Makefile->FindTargetToUse(tei->c_str());
expectedTargets += sep + this->Namespace + te->GetExportName();
@@ -153,6 +158,12 @@ cmExportBuildFileGenerator
}
//----------------------------------------------------------------------------
+void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet)
+{
+ this->ExportSet = exportSet;
+}
+
+//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
@@ -232,6 +243,23 @@ cmExportBuildFileGenerator::HandleMissingTarget(
}
//----------------------------------------------------------------------------
+void cmExportBuildFileGenerator
+::GetTargets(std::vector<std::string> &targets) const
+{
+ if (this->ExportSet)
+ {
+ for(std::vector<cmTargetExport*>::const_iterator
+ tei = this->ExportSet->GetTargetExports()->begin();
+ tei != this->ExportSet->GetTargetExports()->end(); ++tei)
+ {
+ targets.push_back((*tei)->Target->GetName());
+ }
+ return;
+ }
+ targets = this->Targets;
+}
+
+//----------------------------------------------------------------------------
std::vector<std::string>
cmExportBuildFileGenerator
::FindNamespaces(cmMakefile* mf, const std::string& name)
@@ -246,8 +274,8 @@ cmExportBuildFileGenerator
expIt = exportSets.begin(); expIt != exportSets.end(); ++expIt)
{
const cmExportBuildFileGenerator* exportSet = expIt->second;
- std::vector<std::string> const& targets = exportSet->GetTargets();
-
+ std::vector<std::string> targets;
+ exportSet->GetTargets(targets);
if (std::find(targets.begin(), targets.end(), name) != targets.end())
{
namespaces.push_back(exportSet->GetNamespace());
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 2fbd98f..cea2099 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -15,6 +15,8 @@
#include "cmExportFileGenerator.h"
#include "cmListFileCache.h"
+class cmExportSet;
+
/** \class cmExportBuildFileGenerator
* \brief Generate a file exporting targets from a build tree.
*
@@ -32,11 +34,11 @@ public:
/** Set the list of targets to export. */
void SetTargets(std::vector<std::string> const& targets)
{ this->Targets = targets; }
- std::vector<std::string> const& GetTargets() const
- { return this->Targets; }
+ void GetTargets(std::vector<std::string> &targets) const;
void AppendTargets(std::vector<std::string> const& targets)
{ this->Targets.insert(this->Targets.end(),
targets.begin(), targets.end()); }
+ void SetExportSet(cmExportSet*);
/** Set whether to append generated code to the output file. */
void SetAppendMode(bool append) { this->AppendMode = append; }
@@ -75,6 +77,7 @@ protected:
FindNamespaces(cmMakefile* mf, const std::string& name);
std::vector<std::string> Targets;
+ cmExportSet *ExportSet;
std::vector<cmTarget*> Exports;
cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 0a67ccf..b6bf870 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -30,14 +30,12 @@ cmExportCommand::cmExportCommand()
,ArgumentGroup()
,Targets(&Helper, "TARGETS")
,Append(&Helper, "APPEND", &ArgumentGroup)
+,ExportSetName(&Helper, "EXPORT", &ArgumentGroup)
,Namespace(&Helper, "NAMESPACE", &ArgumentGroup)
,Filename(&Helper, "FILE", &ArgumentGroup)
,ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
{
- // at first TARGETS
- this->Targets.Follows(0);
- // and after that the other options in any order
- this->ArgumentGroup.Follows(&this->Targets);
+ this->ExportSet = 0;
}
@@ -55,6 +53,16 @@ bool cmExportCommand
{
return this->HandlePackage(args);
}
+ else if (args[0] == "EXPORT")
+ {
+ this->ExportSetName.Follows(0);
+ this->ArgumentGroup.Follows(&this->ExportSetName);
+ }
+ else
+ {
+ this->Targets.Follows(0);
+ this->ArgumentGroup.Follows(&this->Targets);
+ }
std::vector<std::string> unknownArgs;
this->Helper.Parse(&args, &unknownArgs);
@@ -65,31 +73,32 @@ bool cmExportCommand
return false;
}
- if (this->Targets.WasFound() == false)
- {
- this->SetError("TARGETS option missing.");
- return false;
- }
-
+ std::string fname;
if(!this->Filename.WasFound())
{
- this->SetError("FILE <filename> option missing.");
- return false;
+ if (args[0] != "EXPORT")
+ {
+ this->SetError("FILE <filename> option missing.");
+ return false;
+ }
+ fname = this->ExportSetName.GetString() + ".cmake";
}
-
- // Make sure the file has a .cmake extension.
- if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString())
- != ".cmake")
+ else
{
- cmOStringStream e;
- e << "FILE option given filename \"" << this->Filename.GetString()
- << "\" which does not have an extension of \".cmake\".\n";
- this->SetError(e.str().c_str());
- return false;
+ // Make sure the file has a .cmake extension.
+ if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString())
+ != ".cmake")
+ {
+ cmOStringStream e;
+ e << "FILE option given filename \"" << this->Filename.GetString()
+ << "\" which does not have an extension of \".cmake\".\n";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ fname = this->Filename.GetString();
}
// Get the file to write.
- std::string fname = this->Filename.GetString();
if(cmSystemTools::FileIsFullPath(fname.c_str()))
{
if(!this->Makefile->CanIWriteThisFile(fname.c_str()))
@@ -104,57 +113,95 @@ bool cmExportCommand
else
{
// Interpret relative paths with respect to the current build dir.
- fname = this->Makefile->GetCurrentOutputDirectory();
- fname += "/";
- fname += this->Filename.GetString();
+ std::string dir = this->Makefile->GetCurrentOutputDirectory();
+ fname = dir + "/" + fname;
}
- for(std::vector<std::string>::const_iterator
- currentTarget = this->Targets.GetVector().begin();
- currentTarget != this->Targets.GetVector().end();
- ++currentTarget)
+ std::vector<std::string> targets;
+
+ cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator();
+
+ if(args[0] == "EXPORT")
{
- if (this->Makefile->IsAlias(currentTarget->c_str()))
+ if (this->Append.IsEnabled())
+ {
+ cmOStringStream e;
+ e << "EXPORT signature does not recognise the APPEND option.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ if (this->ExportOld.IsEnabled())
{
cmOStringStream e;
- e << "given ALIAS target \"" << *currentTarget
- << "\" which may not be exported.";
+ e << "EXPORT signature does not recognise the "
+ "EXPORT_LINK_INTERFACE_LIBRARIES option.";
this->SetError(e.str().c_str());
return false;
}
- if(cmTarget* target =
- this->Makefile->GetLocalGenerator()->
- GetGlobalGenerator()->FindTarget(0, currentTarget->c_str()))
+ cmExportSetMap &setMap = gg->GetExportSets();
+ std::string setName = this->ExportSetName.GetString();
+ if (setMap.find(setName) == setMap.end())
{
- if(target->GetType() == cmTarget::OBJECT_LIBRARY)
+ cmOStringStream e;
+ e << "Export set \"" << setName << "\" not found.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ this->ExportSet = setMap[setName];
+ }
+ else if (this->Targets.WasFound())
+ {
+ for(std::vector<std::string>::const_iterator
+ currentTarget = this->Targets.GetVector().begin();
+ currentTarget != this->Targets.GetVector().end();
+ ++currentTarget)
+ {
+ if (this->Makefile->IsAlias(currentTarget->c_str()))
{
cmOStringStream e;
- e << "given OBJECT library \"" << *currentTarget
+ e << "given ALIAS target \"" << *currentTarget
<< "\" which may not be exported.";
this->SetError(e.str().c_str());
return false;
}
+
+ if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str()))
+ {
+ if(target->GetType() == cmTarget::OBJECT_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "given OBJECT library \"" << *currentTarget
+ << "\" which may not be exported.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "given target \"" << *currentTarget
+ << "\" which is not built by this project.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ targets.push_back(*currentTarget);
}
- else
+ if (this->Append.IsEnabled())
{
- cmOStringStream e;
- e << "given target \"" << *currentTarget
- << "\" which is not built by this project.";
- this->SetError(e.str().c_str());
- return false;
+ if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname))
+ {
+ ebfg->AppendTargets(targets);
+ return true;
+ }
}
}
-
- cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator();
- if (this->Append.IsEnabled())
+ else
{
- if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname))
- {
- ebfg->AppendTargets(this->Targets.GetVector());
- return true;
- }
+ this->SetError("EXPORT or TARGETS specifier missing.");
+ return false;
}
// Setup export file generation.
@@ -162,7 +209,14 @@ bool cmExportCommand
ebfg->SetExportFile(fname.c_str());
ebfg->SetNamespace(this->Namespace.GetCString());
ebfg->SetAppendMode(this->Append.IsEnabled());
- ebfg->SetTargets(this->Targets.GetVector());
+ if (this->ExportSet)
+ {
+ ebfg->SetExportSet(this->ExportSet);
+ }
+ else
+ {
+ ebfg->SetTargets(targets);
+ }
ebfg->SetMakefile(this->Makefile);
ebfg->SetExportOld(this->ExportOld.IsEnabled());
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index ea7c3a3..c0e445f 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -15,6 +15,7 @@
#include "cmCommand.h"
class cmExportBuildFileGenerator;
+class cmExportSet;
/** \class cmExportLibraryDependenciesCommand
* \brief Add a test to the lists of tests to run.
@@ -52,10 +53,13 @@ private:
cmCommandArgumentGroup ArgumentGroup;
cmCAStringVector Targets;
cmCAEnabler Append;
+ cmCAString ExportSetName;
cmCAString Namespace;
cmCAString Filename;
cmCAEnabler ExportOld;
+ cmExportSet *ExportSet;
+
friend class cmExportBuildFileGenerator;
std::string ErrorMessage;
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index b713262..f400f13 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -23,11 +23,6 @@ set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_
add_library(sharediface INTERFACE)
target_link_libraries(sharediface INTERFACE sharedlib)
-export(TARGETS sharediface sharedlib headeronly
- NAMESPACE bld::
- FILE ../ExportInterfaceBuildTree.cmake
-)
-
install(TARGETS headeronly sharediface sharedlib
EXPORT expInterface
RUNTIME DESTINATION bin
@@ -47,3 +42,8 @@ install(FILES
)
install(EXPORT expInterface NAMESPACE exp:: DESTINATION lib/exp)
+
+export(EXPORT expInterface
+ NAMESPACE bld::
+ FILE ../ExportInterfaceBuildTree.cmake
+)
diff --git a/Tests/RunCMake/export/AppendExport-result.txt b/Tests/RunCMake/export/AppendExport-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt
new file mode 100644
index 0000000..6e385d4
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at AppendExport.cmake:8 \(export\):
+ export EXPORT signature does not recognise the APPEND option.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake
new file mode 100644
index 0000000..f36010b
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport.cmake
@@ -0,0 +1,8 @@
+add_library(foo empty.cpp)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+export(EXPORT fooExport APPEND FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
diff --git a/Tests/RunCMake/export/NoExportSet-result.txt b/Tests/RunCMake/export/NoExportSet-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/NoExportSet-stderr.txt b/Tests/RunCMake/export/NoExportSet-stderr.txt
new file mode 100644
index 0000000..9d27805
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoExportSet.cmake:2 \(export\):
+ export Export set "fooExport" not found.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/NoExportSet.cmake b/Tests/RunCMake/export/NoExportSet.cmake
new file mode 100644
index 0000000..72390e8
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet.cmake
@@ -0,0 +1,2 @@
+
+export(EXPORT fooExport)
diff --git a/Tests/RunCMake/export/OldIface-result.txt b/Tests/RunCMake/export/OldIface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt
new file mode 100644
index 0000000..afb4ae3
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at OldIface.cmake:8 \(export\):
+ export EXPORT signature does not recognise the
+ EXPORT_LINK_INTERFACE_LIBRARIES option.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake
new file mode 100644
index 0000000..5fb8e25
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface.cmake
@@ -0,0 +1,10 @@
+add_library(foo empty.cpp)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+export(EXPORT fooExport
+ EXPORT_LINK_INTERFACE_LIBRARIES
+)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index b8d3f27..4b04f18 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -1,3 +1,6 @@
include(RunCMake)
run_cmake(TargetNotFound)
+run_cmake(AppendExport)
+run_cmake(OldIface)
+run_cmake(NoExportSet)
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list