summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CheckIncludeFiles.cmake2
-rw-r--r--Modules/CheckSymbolExists.cmake2
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake3
-rw-r--r--Modules/readme.txt5
-rw-r--r--Source/CMakeLists.txt5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmDocumentGeneratorExpressions.h8
-rw-r--r--Source/cmDocumentVariables.cxx15
-rw-r--r--Source/cmExportBuildFileGenerator.cxx23
-rw-r--r--Source/cmExportBuildFileGenerator.h10
-rw-r--r--Source/cmExportFileGenerator.cxx56
-rw-r--r--Source/cmExportFileGenerator.h19
-rw-r--r--Source/cmExportInstallFileGenerator.cxx124
-rw-r--r--Source/cmExportInstallFileGenerator.h59
-rw-r--r--Source/cmExportSet.cxx32
-rw-r--r--Source/cmExportSet.h46
-rw-r--r--Source/cmExportSetMap.cxx34
-rw-r--r--Source/cmExportSetMap.h33
-rw-r--r--Source/cmFindPackageCommand.cxx12
-rw-r--r--Source/cmGlobalGenerator.cxx56
-rw-r--r--Source/cmGlobalGenerator.h30
-rw-r--r--Source/cmInstallCommand.cxx19
-rw-r--r--Source/cmInstallExportGenerator.cxx18
-rw-r--r--Source/cmInstallExportGenerator.h18
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx7
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx4
-rw-r--r--Source/cmTarget.cxx157
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Source/cmTargetExport.h39
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx8
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt12
-rw-r--r--Tests/ExportImport/Export/testLibDepends.c4
-rw-r--r--Tests/ExportImport/Export/testLibRequired.c1
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt4
-rw-r--r--Tests/PDBDirectoryAndName/CMakeLists.txt79
-rw-r--r--Tests/PDBDirectoryAndName/check_pdbs.cmake10
-rw-r--r--Tests/PDBDirectoryAndName/myexe.c5
-rw-r--r--Tests/PDBDirectoryAndName/myexe2.c3
-rw-r--r--Tests/PDBDirectoryAndName/mylibA.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibB.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibC.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibD.c1
-rwxr-xr-xbootstrap2
48 files changed, 781 insertions, 215 deletions
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 70ab9be..daf2dd0 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -71,7 +71,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"exist passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${_description} - not found.")
+ message(STATUS "Looking for ${_description} - not found")
set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} "
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 59b9942..5a8597f 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -89,7 +89,7 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${OUTPUT}\nFile ${SOURCEFILE}:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
else()
- message(STATUS "Looking for ${SYMBOL} - not found.")
+ message(STATUS "Looking for ${SYMBOL} - not found")
set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${SYMBOL} "
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 888e109..25d8df3 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -120,6 +120,9 @@ macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
set(configsText "${configsText} ${filename} (version ${version})\n")
endforeach()
+ if (${_NAME}_NOT_FOUND_MESSAGE)
+ set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
+ endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
else()
diff --git a/Modules/readme.txt b/Modules/readme.txt
index 7d61d8d..4818031 100644
--- a/Modules/readme.txt
+++ b/Modules/readme.txt
@@ -18,6 +18,9 @@ XXX_VERSION_YY Expect Version YY if true. Make sure at most one of thes
XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command.
XXX_YY_FOUND If False, optional YY part of XXX sytem is not available.
XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX.
+XXX_NOT_FOUND_MESSAGE Should be set by config-files in the case that it has set XXX_FOUND to FALSE.
+ The contained message will be printed by the find_package() command and by
+ find_package_handle_standard_args() to inform the user about the problem.
XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries.
The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix.
This should not be a cache entry.
@@ -124,7 +127,7 @@ If neither the QUIET nor REQUIRED options are given then the
FindXXX.cmake module should look for the package and complain without
error if the module is not found.
-A package can be provide sub-components.
+A package can provide sub-components.
Those components can be listed after the COMPONENTS (or REQUIRED)
or OPTIONAL_COMPONENTS keywords. The set of all listed components will be
specified in a XXX_FIND_COMPONENTS variable.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 5a3e7d1..8bf6c40 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -176,6 +176,10 @@ set(SRCS
cmExportFileGenerator.cxx
cmExportInstallFileGenerator.h
cmExportInstallFileGenerator.cxx
+ cmExportSet.h
+ cmExportSet.cxx
+ cmExportSetMap.h
+ cmExportSetMap.cxx
cmExtraCodeBlocksGenerator.cxx
cmExtraCodeBlocksGenerator.h
cmExtraEclipseCDT4Generator.cxx
@@ -259,6 +263,7 @@ set(SRCS
cmSystemTools.h
cmTarget.cxx
cmTarget.h
+ cmTargetExport.h
cmTest.cxx
cmTest.h
cmTestGenerator.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 7be0929..84cc45b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 9)
-set(CMake_VERSION_TWEAK 20120930)
+set(CMake_VERSION_TWEAK 20121002)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 6b0cf49..445fd0e 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -35,18 +35,20 @@
" $<TARGET_FILE_DIR:tgt>/$<TARGET_FILE_NAME:tgt>\n" \
" $<TARGET_LINKER_FILE_DIR:tgt>/$<TARGET_LINKER_FILE_NAME:tgt>\n" \
" $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>\n" \
+ "\n" \
" $<TARGET_PROPERTY:tgt,prop> = The value of the property prop\n" \
- "the target tgt. Note that tgt is not added as a dependency of the " \
- "target this expression is evaluated on.\n" \
+ "on the target tgt. Note that tgt is not added as a dependency of\n" \
+ "the target this expression is evaluated on.\n" \
"Boolean expressions:\n" \
" $<AND:?[,?]...> = '1' if all '?' are '1', else '0'\n" \
" $<OR:?[,?]...> = '0' if all '?' are '0', else '1'\n" \
" $<NOT:?> = '0' if '?' is '1', else '1'\n" \
"where '?' is always either '0' or '1'.\n" \
+ ""
#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \
CM_DOCUMENT_ADD_TEST_GENERATOR_EXPRESSIONS \
- "Expressions with an implicit 'this' target:" \
+ "Expressions with an implicit 'this' target:\n" \
" $<TARGET_PROPERTY:prop> = The value of the property prop on\n" \
"the target on which the generator expression is evaluated.\n" \
""
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 5e7e081..8db0e8f 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -701,7 +701,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_SYSTEM_IGNORE_PATH", cmProperty::VARIABLE,
"Path to be ignored by FIND_XXX() commands.",
- "Specifies directories to be ignored by searches in FIND_XXX() commands "
+ "Specifies directories to be ignored by searches in FIND_XXX() "
+ "commands. "
"This is useful in cross-compiled environments where some system "
"directories contain incompatible but possibly linkable libraries. For "
"example, on cross-compiled cluster environments, this allows a user to "
@@ -716,7 +717,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_IGNORE_PATH", cmProperty::VARIABLE,
"Path to be ignored by FIND_XXX() commands.",
- "Specifies directories to be ignored by searches in FIND_XXX() commands "
+ "Specifies directories to be ignored by searches in FIND_XXX() "
+ "commands. "
"This is useful in cross-compiled environments where some system "
"directories contain incompatible but possibly linkable libraries. For "
"example, on cross-compiled cluster environments, this allows a user to "
@@ -1211,6 +1213,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_PDB_OUTPUT_DIRECTORY", cmProperty::VARIABLE,
+ "Where to put all the MS debug symbol files.",
+ "This variable is used to initialize the "
+ "PDB_OUTPUT_DIRECTORY property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_AUTOMOC", cmProperty::VARIABLE,
"Whether to handle moc automatically for Qt targets.",
"This variable is used to initialize the "
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 32595ee..fb3f39f 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -72,8 +72,9 @@ cmExportBuildFileGenerator
if(!properties.empty())
{
// Get the rest of the target details.
+ std::vector<std::string> missingTargets;
this->SetImportDetailProperties(config, suffix,
- target, properties);
+ target, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
@@ -82,6 +83,7 @@ cmExportBuildFileGenerator
// properties);
// Generate code in the export file.
+ this->GenerateMissingTargetsCheckCode(os, missingTargets);
this->GenerateImportPropertyCode(os, config, target, properties);
}
}
@@ -133,6 +135,25 @@ cmExportBuildFileGenerator
//----------------------------------------------------------------------------
void
+cmExportBuildFileGenerator::HandleMissingTarget(
+ std::string& link_libs, std::vector<std::string>&,
+ cmMakefile*, cmTarget* depender, cmTarget* dependee)
+{
+ // The target is not in the export.
+ if(!this->AppendMode)
+ {
+ // We are not appending, so all exported targets should be
+ // known here. This is probably user-error.
+ this->ComplainAboutMissingTarget(depender, dependee);
+ }
+ // Assume the target will be exported by another command.
+ // Append it with the export namespace.
+ link_libs += this->Namespace;
+ link_libs += dependee->GetName();
+}
+
+//----------------------------------------------------------------------------
+void
cmExportBuildFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee)
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 0f37626..726537b 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -45,8 +45,14 @@ protected:
virtual void GenerateImportTargetsConfig(std::ostream& os,
const char* config,
std::string const& suffix);
- virtual void ComplainAboutMissingTarget(cmTarget* depender,
- cmTarget* dependee);
+ virtual void HandleMissingTarget(std::string& link_libs,
+ std::vector<std::string>& missingTargets,
+ cmMakefile* mf,
+ cmTarget* depender,
+ cmTarget* dependee);
+
+ void ComplainAboutMissingTarget(cmTarget* depender,
+ cmTarget* dependee);
/** Fill in properties indicating built file locations. */
void SetImportLocationProperty(const char* config,
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index eb19df5e..8dffae4 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -11,10 +11,15 @@
============================================================================*/
#include "cmExportFileGenerator.h"
+#include "cmExportSet.h"
#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmInstallExportGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetExport.h"
#include "cmVersion.h"
#include <cmsys/auto_ptr.hxx>
@@ -123,7 +128,9 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
void
cmExportFileGenerator
::SetImportDetailProperties(const char* config, std::string const& suffix,
- cmTarget* target, ImportPropertyMap& properties)
+ cmTarget* target, ImportPropertyMap& properties,
+ std::vector<std::string>& missingTargets
+ )
{
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
@@ -159,13 +166,13 @@ cmExportFileGenerator
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
- iface->Languages, properties);
+ iface->Languages, properties, missingTargets);
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LIBRARIES",
- iface->Libraries, properties);
+ iface->Libraries, properties, missingTargets);
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_DEPENDENT_LIBRARIES",
- iface->SharedDeps, properties);
+ iface->SharedDeps, properties, missingTargets);
if(iface->Multiplicity > 0)
{
std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
@@ -184,7 +191,9 @@ cmExportFileGenerator
cmTarget* target,
const char* propName,
std::vector<std::string> const& libs,
- ImportPropertyMap& properties)
+ ImportPropertyMap& properties,
+ std::vector<std::string>& missingTargets
+ )
{
// Skip the property if there are no libraries.
if(libs.empty())
@@ -224,17 +233,7 @@ cmExportFileGenerator
}
else
{
- // The target is not in the export.
- if(!this->AppendMode)
- {
- // We are not appending, so all exported targets should be
- // known here. This is probably user-error.
- this->ComplainAboutMissingTarget(target, tgt);
- }
- // Assume the target will be exported by another command.
- // Append it with the export namespace.
- link_libs += this->Namespace;
- link_libs += *li;
+ this->HandleMissingTarget(link_libs, missingTargets, mf, target, tgt);
}
}
else
@@ -250,6 +249,7 @@ cmExportFileGenerator
properties[prop] = link_libs;
}
+
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
const char* config)
@@ -381,6 +381,30 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
+void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
+ const std::vector<std::string>& missingTargets)
+{
+ os << "# Make sure the targets which have been exported in some other \n"
+ "# export set exist.\n";
+ for(unsigned int i=0; i<missingTargets.size(); ++i)
+ {
+ os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
+ << " IF(CMAKE_FIND_PACKAGE_NAME)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
+ << "\"Required imported target \\\"" << missingTargets[i]
+ << "\\\" not found ! \")\n"
+ << " ELSE()\n"
+ << " MESSAGE(FATAL_ERROR \"Required imported target \\\""
+ << missingTargets[i] << "\\\" not found ! \")\n"
+ << " ENDIF()\n"
+ << "ENDIF()\n";
+ }
+ os << "\n";
+}
+
+
+//----------------------------------------------------------------------------
void
cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
{
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index f271e55..70bc65d 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -60,17 +60,21 @@ protected:
ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations);
void GenerateImportedFileCheckLoop(std::ostream& os);
+ void GenerateMissingTargetsCheckCode(std::ostream& os,
+ const std::vector<std::string>& missingTargets);
// Collect properties with detailed information about targets beyond
// their location on disk.
void SetImportDetailProperties(const char* config,
std::string const& suffix, cmTarget* target,
- ImportPropertyMap& properties);
+ ImportPropertyMap& properties,
+ std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const char* propName,
std::vector<std::string> const& libs,
- ImportPropertyMap& properties);
+ ImportPropertyMap& properties,
+ std::vector<std::string>& missingTargets);
/** Each subclass knows how to generate its kind of export file. */
virtual bool GenerateMainFile(std::ostream& os) = 0;
@@ -80,10 +84,13 @@ protected:
const char* config,
std::string const& suffix) = 0;
- /** Each subclass knows how to complain about a target that is
- missing from an export set. */
- virtual void ComplainAboutMissingTarget(cmTarget* depender,
- cmTarget* dependee) = 0;
+ /** Each subclass knows how to deal with a target that is missing from an
+ * export set. */
+ virtual void HandleMissingTarget(std::string& link_libs,
+ std::vector<std::string>& missingTargets,
+ cmMakefile* mf,
+ cmTarget* depender,
+ cmTarget* dependee) = 0;
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index da14dd7..7841731 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -11,14 +11,19 @@
============================================================================*/
#include "cmExportInstallFileGenerator.h"
+#include "cmExportSet.h"
+#include "cmExportSetMap.h"
#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
+#include "cmTargetExport.h"
//----------------------------------------------------------------------------
cmExportInstallFileGenerator
::cmExportInstallFileGenerator(cmInstallExportGenerator* iegen):
- InstallExportGenerator(iegen)
+ IEGen(iegen)
{
}
@@ -36,10 +41,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
- tei = this->ExportSet->begin();
- tei != this->ExportSet->end(); ++tei)
+ tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
+ tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
{
- cmTargetExport* te = *tei;
+ cmTargetExport const* te = *tei;
if(this->ExportedTargets.insert(te->Target).second)
{
this->GenerateImportTargetCode(os, te->Target);
@@ -47,8 +52,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
else
{
cmOStringStream e;
- e << "INSTALL(EXPORT \"" << this->Name << "\" ...) "
- << "includes target \"" << te->Target->GetName()
+ e << "INSTALL(EXPORT \""
+ << this->IEGen->GetExportSet()->GetName()
+ << "\" ...) " << "includes target \"" << te->Target->GetName()
<< "\" more than once in the export set.";
cmSystemTools::Error(e.str().c_str());
return false;
@@ -84,7 +90,7 @@ bool
cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config)
{
// Skip configurations not enabled for this export.
- if(!this->InstallExportGenerator->InstallsForConfig(config))
+ if(!this->IEGen->InstallsForConfig(config))
{
return true;
}
@@ -140,7 +146,7 @@ cmExportInstallFileGenerator
{
// Add code to compute the installation prefix relative to the
// import file location.
- const char* installDest = this->InstallExportGenerator->GetDestination();
+ const char* installDest = this->IEGen->GetDestination();
if(!cmSystemTools::FileIsFullPath(installDest))
{
std::string dest = installDest;
@@ -161,11 +167,11 @@ cmExportInstallFileGenerator
// Add each target in the set to the export.
for(std::vector<cmTargetExport*>::const_iterator
- tei = this->ExportSet->begin();
- tei != this->ExportSet->end(); ++tei)
+ tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
+ tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
{
// Collect import properties for this target.
- cmTargetExport* te = *tei;
+ cmTargetExport const* te = *tei;
ImportPropertyMap properties;
std::set<std::string> importedLocations;
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
@@ -185,8 +191,9 @@ cmExportInstallFileGenerator
if(!properties.empty())
{
// Get the rest of the target details.
+ std::vector<std::string> missingTargets;
this->SetImportDetailProperties(config, suffix,
- te->Target, properties);
+ te->Target, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
@@ -195,6 +202,7 @@ cmExportInstallFileGenerator
// properties);
// Generate code in the export file.
+ this->GenerateMissingTargetsCheckCode(os, missingTargets);
this->GenerateImportPropertyCode(os, config, te->Target, properties);
this->GenerateImportedFileChecksCode(os, te->Target, properties,
importedLocations);
@@ -306,12 +314,80 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
+cmExportInstallFileGenerator::HandleMissingTarget(
+ std::string& link_libs, std::vector<std::string>& missingTargets,
+ cmMakefile* mf, cmTarget* depender, cmTarget* dependee)
+{
+ std::string name = dependee->GetName();
+ std::vector<std::string> namespaces = this->FindNamespaces(mf, name);
+ int targetOccurrences = (int)namespaces.size();
+ if (targetOccurrences == 1)
+ {
+ std::string missingTarget = namespaces[0];
+ missingTarget += name;
+ link_libs += missingTarget;
+ missingTargets.push_back(missingTarget);
+ }
+ else
+ {
+ // We are not appending, so all exported targets should be
+ // known here. This is probably user-error.
+ this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
+ }
+}
+
+//----------------------------------------------------------------------------
+std::vector<std::string>
+cmExportInstallFileGenerator
+::FindNamespaces(cmMakefile* mf, const std::string& name)
+{
+ std::vector<std::string> namespaces;
+ cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator();
+ const cmExportSetMap& exportSets = gg->GetExportSets();
+
+ for(cmExportSetMap::const_iterator expIt = exportSets.begin();
+ expIt != exportSets.end();
+ ++expIt)
+ {
+ const cmExportSet* exportSet = expIt->second;
+ std::vector<cmTargetExport*> const* targets =
+ exportSet->GetTargetExports();
+
+ bool containsTarget = false;
+ for(unsigned int i=0; i<targets->size(); i++)
+ {
+ if (name == (*targets)[i]->Target->GetName())
+ {
+ containsTarget = true;
+ break;
+ }
+ }
+
+ if (containsTarget)
+ {
+ std::vector<cmInstallExportGenerator const*> const* installs =
+ exportSet->GetInstallations();
+ for(unsigned int i=0; i<installs->size(); i++)
+ {
+ namespaces.push_back((*installs)[i]->GetNamespace());
+ }
+ }
+ }
+
+ return namespaces;
+}
+
+
+//----------------------------------------------------------------------------
+void
cmExportInstallFileGenerator
::ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen)
{
- const char* installDest = this->InstallExportGenerator->GetDestination();
+ const char* installDest = this->IEGen->GetDestination();
cmOStringStream e;
- e << "INSTALL(EXPORT \"" << this->Name << "\") given absolute "
+ e << "INSTALL(EXPORT \""
+ << this->IEGen->GetExportSet()->GetName()
+ << "\") given absolute "
<< "DESTINATION \"" << installDest << "\" but the export "
<< "references an installation of target \""
<< itgen->GetTarget()->GetName() << "\" which has relative "
@@ -322,12 +398,24 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator
-::ComplainAboutMissingTarget(cmTarget* depender, cmTarget* dependee)
+::ComplainAboutMissingTarget(cmTarget* depender,
+ cmTarget* dependee,
+ int occurrences)
{
cmOStringStream e;
- e << "INSTALL(EXPORT \"" << this->Name << "\" ...) "
+ e << "INSTALL(EXPORT \""
+ << this->IEGen->GetExportSet()->GetName()
+ << "\" ...) "
<< "includes target \"" << depender->GetName()
- << "\" which requires target \"" << dependee->GetName()
- << "\" that is not in the export set.";
+ << "\" which requires target \"" << dependee->GetName() << "\" ";
+ if (occurrences == 0)
+ {
+ e << "that is not in the export set.";
+ }
+ else
+ {
+ e << "that is not in this export set, but " << occurrences
+ << " times in others.";
+ }
cmSystemTools::Error(e.str().c_str());
}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index fb678e8..e719ecc 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -18,6 +18,7 @@ class cmInstallExportGenerator;
class cmInstallFilesGenerator;
class cmInstallTargetGenerator;
class cmTargetExport;
+class cmExportSet;
/** \class cmExportInstallFileGenerator
* \brief Generate a file exporting targets from an install tree.
@@ -40,15 +41,6 @@ public:
files. */
cmExportInstallFileGenerator(cmInstallExportGenerator* iegen);
- /** Set the name of the export associated with the files. This is
- the name given to the install(EXPORT) command mode. */
- void SetName(const char* name) { this->Name = name; }
-
- /** Set the set of targets to be exported. These are the targets
- associated with the export name. */
- void SetExportSet(std::vector<cmTargetExport*> const* eSet)
- { this->ExportSet = eSet; }
-
/** Get the per-config file generated for each configuraiton. This
maps from the configuration name to the file temporary location
for installation. */
@@ -65,8 +57,19 @@ protected:
virtual void GenerateImportTargetsConfig(std::ostream& os,
const char* config,
std::string const& suffix);
- virtual void ComplainAboutMissingTarget(cmTarget* depender,
- cmTarget* dependee);
+ virtual void HandleMissingTarget(std::string& link_libs,
+ std::vector<std::string>& missingTargets,
+ cmMakefile* mf,
+ cmTarget* depender,
+ cmTarget* dependee);
+
+ void ComplainAboutMissingTarget(cmTarget* depender,
+ cmTarget* dependee,
+ int occurrences);
+
+ std::vector<std::string> FindNamespaces(cmMakefile* mf,
+ const std::string& name);
+
/** Generate a per-configuration file for the targets. */
bool GenerateImportFileConfig(const char* config);
@@ -81,9 +84,7 @@ protected:
void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
- cmInstallExportGenerator* InstallExportGenerator;
- std::string Name;
- std::vector<cmTargetExport*> const* ExportSet;
+ cmInstallExportGenerator* IEGen;
std::string ImportPrefix;
@@ -91,34 +92,4 @@ protected:
std::map<cmStdString, cmStdString> ConfigImportFiles;
};
-/*
- cmTargetExport is used in cmGlobalGenerator to collect the install
- generators for targets associated with an export.
-*/
-class cmTargetExport
-{
-public:
- cmTargetExport(cmTarget* tgt,
- cmInstallTargetGenerator* archive,
- cmInstallTargetGenerator* runtime,
- cmInstallTargetGenerator* library,
- cmInstallTargetGenerator* framework,
- cmInstallTargetGenerator* bundle,
- cmInstallFilesGenerator* headers
- ) : Target(tgt), ArchiveGenerator(archive),
- RuntimeGenerator(runtime), LibraryGenerator(library),
- FrameworkGenerator(framework), BundleGenerator(bundle),
- HeaderGenerator(headers) {}
-
- cmTarget* Target;
- cmInstallTargetGenerator* ArchiveGenerator;
- cmInstallTargetGenerator* RuntimeGenerator;
- cmInstallTargetGenerator* LibraryGenerator;
- cmInstallTargetGenerator* FrameworkGenerator;
- cmInstallTargetGenerator* BundleGenerator;
- cmInstallFilesGenerator* HeaderGenerator;
-private:
- cmTargetExport();
-};
-
#endif
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
new file mode 100644
index 0000000..33b0630
--- /dev/null
+++ b/Source/cmExportSet.cxx
@@ -0,0 +1,32 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmExportSet.h"
+#include "cmTargetExport.h"
+
+cmExportSet::~cmExportSet()
+{
+ for(unsigned int i = 0; i < this->TargetExports.size(); ++ i)
+ {
+ delete this->TargetExports[i];
+ }
+}
+
+void cmExportSet::AddTargetExport(cmTargetExport* te)
+{
+ this->TargetExports.push_back(te);
+}
+
+void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
+{
+ this->Installations.push_back(installation);
+}
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
new file mode 100644
index 0000000..a57aa12
--- /dev/null
+++ b/Source/cmExportSet.h
@@ -0,0 +1,46 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmExportSet_h
+#define cmExportSet_h
+
+#include "cmSystemTools.h"
+class cmTargetExport;
+class cmInstallExportGenerator;
+
+/// A set of targets that were installed with the same EXPORT parameter.
+class cmExportSet
+{
+public:
+ /// Construct an empty export set named \a name
+ cmExportSet(const std::string &name) : Name(name) {}
+ /// Destructor
+ ~cmExportSet();
+
+ void AddTargetExport(cmTargetExport* tgt);
+
+ void AddInstallation(cmInstallExportGenerator const* installation);
+
+ std::string const& GetName() const { return this->Name; }
+
+ std::vector<cmTargetExport*> const* GetTargetExports() const
+ { return &this->TargetExports; }
+
+ std::vector<cmInstallExportGenerator const*> const* GetInstallations() const
+ { return &this->Installations; }
+
+private:
+ std::vector<cmTargetExport*> TargetExports;
+ std::string Name;
+ std::vector<cmInstallExportGenerator const*> Installations;
+};
+
+#endif
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
new file mode 100644
index 0000000..96fdb3e
--- /dev/null
+++ b/Source/cmExportSetMap.cxx
@@ -0,0 +1,34 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmExportSetMap.h"
+#include "cmExportSet.h"
+
+cmExportSet* cmExportSetMap::operator[](const std::string &name)
+{
+ std::map<std::string, cmExportSet*>::iterator it = this->find(name);
+ if (it == this->end()) // Export set not found
+ {
+ it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
+ }
+ return it->second;
+}
+
+cmExportSetMap::~cmExportSetMap()
+{
+ for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
+ it != this->end();
+ ++ it)
+ {
+ delete it->second;
+ }
+}
diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h
new file mode 100644
index 0000000..4663c55
--- /dev/null
+++ b/Source/cmExportSetMap.h
@@ -0,0 +1,33 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmExportSetMap_h
+#define cmExportSetMap_h
+
+#include "cmSystemTools.h"
+class cmExportSet;
+
+/// A name -> cmExportSet map with overloaded operator[].
+class cmExportSetMap : public std::map<std::string, cmExportSet*>
+{
+public:
+ /** \brief Overloaded operator[].
+ *
+ * The operator is overloaded because cmExportSet has no default constructor:
+ * we do not want unnamed export sets.
+ */
+ cmExportSet* operator[](const std::string &name);
+
+ /// Overloaded destructor deletes all member export sets.
+ ~cmExportSetMap();
+};
+
+#endif
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index be47f95..470ceca 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -840,6 +840,8 @@ bool cmFindPackageCommand
//----------------------------------------------------------------------------
void cmFindPackageCommand::SetModuleVariables(const std::string& components)
{
+ this->AddFindDefinition("CMAKE_FIND_PACKAGE_NAME", this->Name.c_str());
+
// Store the list of components.
std::string components_var = this->Name + "_FIND_COMPONENTS";
this->AddFindDefinition(components_var.c_str(), components.c_str());
@@ -1016,6 +1018,9 @@ bool cmFindPackageCommand::HandlePackageMode()
std::string foundVar = this->Name;
foundVar += "_FOUND";
+ std::string notFoundMessageVar = this->Name;
+ notFoundMessageVar += "_NOT_FOUND_MESSAGE";
+ std::string notFoundMessage;
// If the directory for the config file was found, try to read the file.
bool result = true;
@@ -1033,6 +1038,7 @@ bool cmFindPackageCommand::HandlePackageMode()
// has set Foo_FOUND to FALSE itself:
this->Makefile->RemoveDefinition(foundVar.c_str());
}
+ this->Makefile->RemoveDefinition(notFoundMessageVar.c_str());
// Set the version variables before loading the config file.
// It may override them.
@@ -1051,6 +1057,8 @@ bool cmFindPackageCommand::HandlePackageMode()
// we get here if the Config file has set Foo_FOUND actively to FALSE
found = false;
configFileSetFOUNDFalse = true;
+ notFoundMessage = this->Makefile->GetSafeDefinition(
+ notFoundMessageVar.c_str());
}
}
else
@@ -1071,6 +1079,10 @@ bool cmFindPackageCommand::HandlePackageMode()
" " << this->FileFound << "\n"
"but it set " << foundVar << " to FALSE so package \"" <<
this->Name << "\" is considered to be NOT FOUND.";
+ if (!notFoundMessage.empty())
+ {
+ e << " Reason given by package: \n" << notFoundMessage << "\n";
+ }
}
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ac75933..09588f9 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -21,7 +21,7 @@
#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
#include "cmVersion.h"
-#include "cmExportInstallFileGenerator.h"
+#include "cmTargetExport.h"
#include "cmComputeTargetDepends.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
@@ -76,12 +76,12 @@ cmGlobalGenerator::~cmGlobalGenerator()
}
this->ClearGeneratorTargets();
- this->ClearExportSets();
}
void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
cmMakefile *mf,
- bool optional) {
+ bool optional)
+{
std::string langComp = "CMAKE_";
langComp += lang;
langComp += "_COMPILER";
@@ -817,7 +817,7 @@ void cmGlobalGenerator::Configure()
{
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorTargets();
- this->ClearExportSets();
+ this->ExportSets.clear();
// Delete any existing cmLocalGenerators
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
@@ -893,7 +893,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
<< "The \"" << this->GetName() << "\" generator does not support "
<< "duplicate custom targets. "
<< "Consider using a Makefiles generator or fix the project to not "
- << "use duplicat target names.";
+ << "use duplicate target names.";
cmSystemTools::Error(e.str().c_str());
return false;
}
@@ -1489,52 +1489,6 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
-void cmGlobalGenerator::AddTargetToExports(const char* exportSetName,
- cmTarget* target,
- cmInstallTargetGenerator* archive,
- cmInstallTargetGenerator* runTime,
- cmInstallTargetGenerator* library,
- cmInstallTargetGenerator* framework,
- cmInstallTargetGenerator* bundle,
- cmInstallFilesGenerator* headers)
-{
- if ((exportSetName) && (*exportSetName) && (target))
- {
- cmTargetExport* te = new cmTargetExport(target, archive, runTime, library,
- framework, bundle, headers);
- this->ExportSets[exportSetName].push_back(te);
- }
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalGenerator::ClearExportSets()
-{
- for(std::map<cmStdString, std::vector<cmTargetExport*> >::iterator
- setIt = this->ExportSets.begin();
- setIt != this->ExportSets.end(); ++setIt)
- {
- for(unsigned int i = 0; i < setIt->second.size(); ++i)
- {
- delete setIt->second[i];
- }
- }
- this->ExportSets.clear();
-}
-
-const std::vector<cmTargetExport*>* cmGlobalGenerator::GetExportSet(
- const char* name) const
-{
- std::map<cmStdString, std::vector<cmTargetExport*> >::const_iterator
- exportSetIt = this->ExportSets.find(name);
- if (exportSetIt != this->ExportSets.end())
- {
- return &exportSetIt->second;
- }
-
- return 0;
-}
-
-
void cmGlobalGenerator::EnableInstallTarget()
{
this->InstallTargetEnabled = true;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 2f4ebc3..0aab2d6 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -18,14 +18,15 @@
#include "cmTarget.h" // For cmTargets
#include "cmTargetDepend.h" // For cmTargetDependSet
#include "cmSystemTools.h" // for cmSystemTools::OutputOption
+#include "cmExportSetMap.h" // For cmExportSetMap
#include "cmGeneratorTarget.h"
+
class cmake;
class cmGeneratorTarget;
class cmMakefile;
class cmLocalGenerator;
class cmExternalMakefileProjectGenerator;
class cmTarget;
-class cmTargetExport;
class cmInstallTargetGenerator;
class cmInstallFilesGenerator;
@@ -128,8 +129,8 @@ public:
void SetCMakeInstance(cmake *cm);
///! Get the CMake instance
- cmake *GetCMakeInstance() { return this->CMakeInstance; };
- const cmake *GetCMakeInstance() const { return this->CMakeInstance; };
+ cmake *GetCMakeInstance() { return this->CMakeInstance; }
+ const cmake *GetCMakeInstance() const { return this->CMakeInstance; }
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
@@ -152,18 +153,9 @@ public:
void AddInstallComponent(const char* component);
const std::set<cmStdString>* GetInstallComponents() const
- { return &InstallComponents; }
-
- ///! Add one installed target to the sets of the exports
- void AddTargetToExports(const char* exportSet, cmTarget* target,
- cmInstallTargetGenerator* archive,
- cmInstallTargetGenerator* runTime,
- cmInstallTargetGenerator* library,
- cmInstallTargetGenerator* framework,
- cmInstallTargetGenerator* bundle,
- cmInstallFilesGenerator* publicHeaders);
- ///! Get the export target set with the given name
- const std::vector<cmTargetExport*>* GetExportSet(const char* name) const;
+ { return &this->InstallComponents; }
+
+ cmExportSetMap& GetExportSets() {return this->ExportSets;}
/** Add a file to the manifest of generated targets for a configuration. */
void AddToManifest(const char* config, std::string const& f);
@@ -223,7 +215,7 @@ public:
/** Get the manifest of all targets that will be built for each
configuration. This is valid during generation only. */
cmTargetManifest const& GetTargetManifest() const
- { return this->TargetManifest; }
+ { return this->TargetManifest; }
/** Get the content of a directory. Directory listings are loaded
from disk at most once and cached. During the generation step
@@ -329,15 +321,13 @@ protected:
cmLocalGenerator* CurrentLocalGenerator;
// map from project name to vector of local generators in that project
std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap;
- std::map<cmLocalGenerator*, std::set<cmTarget *> >
- LocalGeneratorToTargetMap;
+ std::map<cmLocalGenerator*, std::set<cmTarget *> > LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
std::set<cmStdString> InstallComponents;
bool InstallTargetEnabled;
// Sets of named target exports
- std::map<cmStdString, std::vector<cmTargetExport*> > ExportSets;
- void ClearExportSets();
+ cmExportSetMap ExportSets;
// Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 4016734..dcd418b 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -17,6 +17,8 @@
#include "cmInstallTargetGenerator.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallCommandArguments.h"
+#include "cmTargetExport.h"
+#include "cmExportSet.h"
#include <cmsys/Glob.hxx>
@@ -735,11 +737,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// this is not a namelink-only rule.
if(!exports.GetString().empty() && !namelinkOnly)
{
+ cmTargetExport *te = new cmTargetExport;
+ te->Target = &target;
+ te->ArchiveGenerator = archiveGenerator;
+ te->BundleGenerator = bundleGenerator;
+ te->FrameworkGenerator = frameworkGenerator;
+ te->HeaderGenerator = publicHeaderGenerator;
+ te->LibraryGenerator = libraryGenerator;
+ te->RuntimeGenerator = runtimeGenerator;
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddTargetToExports(exports.GetCString(), &target,
- archiveGenerator, runtimeGenerator,
- libraryGenerator, frameworkGenerator,
- bundleGenerator, publicHeaderGenerator);
+ ->GetExportSets()[exports.GetString()]->AddTargetExport(te);
}
}
@@ -1264,7 +1271,9 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
// Create the export install generator.
cmInstallExportGenerator* exportGenerator =
new cmInstallExportGenerator(
- exp.GetCString(), ica.GetDestination().c_str(),
+ this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->GetExportSets()[exp.GetString()],
+ ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(),
ica.GetComponent().c_str(), fname.c_str(),
name_space.GetCString(), this->Makefile);
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 28a19d7..0a645a8 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -23,10 +23,11 @@
#include "cmInstallFilesGenerator.h"
#include "cmExportInstallFileGenerator.h"
+#include "cmExportSet.h"
//----------------------------------------------------------------------------
cmInstallExportGenerator::cmInstallExportGenerator(
- const char* name,
+ cmExportSet* exportSet,
const char* destination,
const char* file_permissions,
std::vector<std::string> const& configurations,
@@ -34,13 +35,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
const char* filename, const char* name_space,
cmMakefile* mf)
:cmInstallGenerator(destination, configurations, component)
- ,Name(name)
+ ,ExportSet(exportSet)
,FilePermissions(file_permissions)
,FileName(filename)
,Namespace(name_space)
,Makefile(mf)
{
this->EFGen = new cmExportInstallFileGenerator(this);
+ exportSet->AddInstallation(this);
}
//----------------------------------------------------------------------------
@@ -113,16 +115,12 @@ void cmInstallExportGenerator::ComputeTempDir()
//----------------------------------------------------------------------------
void cmInstallExportGenerator::GenerateScript(std::ostream& os)
{
- // Get the export set requested.
- ExportSet const* exportSet =
- this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->GetExportSet(this->Name.c_str());
-
// Skip empty sets.
- if(!exportSet)
+ if(ExportSet->GetTargetExports()->empty())
{
cmOStringStream e;
- e << "INSTALL(EXPORT) given unknown export \"" << this->Name << "\"";
+ e << "INSTALL(EXPORT) given unknown export \""
+ << ExportSet->GetName() << "\"";
cmSystemTools::Error(e.str().c_str());
return;
}
@@ -137,8 +135,6 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
this->MainImportFile += this->FileName;
// Generate the import file for this export set.
- this->EFGen->SetName(this->Name.c_str());
- this->EFGen->SetExportSet(exportSet);
this->EFGen->SetExportFile(this->MainImportFile.c_str());
this->EFGen->SetNamespace(this->Namespace.c_str());
if(this->ConfigurationTypes->empty())
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 1ff6e38..ee92906 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -17,8 +17,7 @@
class cmExportInstallFileGenerator;
class cmInstallFilesGenerator;
class cmInstallTargetGenerator;
-class cmTarget;
-class cmTargetExport;
+class cmExportSet;
class cmMakefile;
/** \class cmInstallExportGenerator
@@ -27,24 +26,27 @@ class cmMakefile;
class cmInstallExportGenerator: public cmInstallGenerator
{
public:
- cmInstallExportGenerator(const char* name,
+ cmInstallExportGenerator(cmExportSet* exportSet,
const char* dest, const char* file_permissions,
const std::vector<std::string>& configurations,
const char* component,
const char* filename, const char* name_space,
cmMakefile* mf);
~cmInstallExportGenerator();
-protected:
- typedef std::vector<cmTargetExport*> ExportSet;
+ cmExportSet* GetExportSet() {return this->ExportSet;}
+
+ const std::string& GetNamespace() const { return this->Namespace; }
+
+protected:
virtual void GenerateScript(std::ostream& os);
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
- void GenerateImportFile(ExportSet const* exportSet);
- void GenerateImportFile(const char* config, ExportSet const* exportSet);
+ void GenerateImportFile(cmExportSet const* exportSet);
+ void GenerateImportFile(const char* config, cmExportSet const* exportSet);
void ComputeTempDir();
- std::string Name;
+ cmExportSet* ExportSet;
std::string FilePermissions;
std::string FileName;
std::string Namespace;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 11d9d9c..33d6e05 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -842,7 +842,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// non-debug configurations because VS still creates .idb files.
fout << "\t\t\t\tProgramDataBaseFileName=\""
<< this->ConvertToXMLOutputPathSingle(
- target.GetDirectory(configName).c_str())
+ target.GetPDBDirectory(configName).c_str())
<< "/"
<< target.GetPDBName(configName) << "\"\n";
}
@@ -1122,7 +1122,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories());
fout << "\"\n";
- temp = target.GetDirectory(configName);
+ temp = target.GetPDBDirectory(configName);
temp += "/";
temp += targetNamePDB;
fout << "\t\t\t\tProgramDatabaseFile=\"" <<
@@ -1210,7 +1210,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->OutputLibraryDirectories(fout, cli.GetDirectories());
fout << "\"\n";
std::string path = this->ConvertToXMLOutputPathSingle(
- target.GetDirectory(configName).c_str());
+ target.GetPDBDirectory(configName).c_str());
fout << "\t\t\t\tProgramDatabaseFile=\""
<< path << "/" << targetNamePDB
<< "\"\n";
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index ca5f26a..761cb26 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -131,9 +131,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
outpathImp += "/";
}
}
+
+ std::string pdbOutputPath = this->Target->GetPDBDirectory();
+ cmSystemTools::MakeDirectory(pdbOutputPath.c_str());
+ pdbOutputPath += "/";
+
std::string targetFullPath = outpath + targetName;
std::string targetFullPathReal = outpath + targetNameReal;
- std::string targetFullPathPDB = outpath + targetNamePDB;
+ std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
std::string targetFullPathImport = outpathImp + targetNameImport;
std::string targetOutPathPDB =
this->Convert(targetFullPathPDB.c_str(),
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 368d6fc..cb2b8c8 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -328,8 +328,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
}
+ std::string pdbOutputPath = this->Target->GetPDBDirectory();
+ cmSystemTools::MakeDirectory(pdbOutputPath.c_str());
+ pdbOutputPath += "/";
+
std::string targetFullPath = outpath + targetName;
- std::string targetFullPathPDB = outpath + targetNamePDB;
+ std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
std::string targetFullPathSO = outpath + targetNameSO;
std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathImport = outpathImp + targetNameImport;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9560c10..5cc67e2 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -647,7 +647,7 @@ cmMakefileTargetGenerator
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{
- targetFullPathPDB = this->Target->GetDirectory(this->ConfigName);
+ targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/";
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8db06d3..612e047 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -329,10 +329,10 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{
- pdbPath = this->Target->GetDirectory(this->GetConfigName());
+ pdbPath = this->Target->GetPDBDirectory(this->GetConfigName());
pdbPath += "/";
pdbPath += this->Target->GetPDBName(this->GetConfigName());
- }
+ }
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 532d482..423b350 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -16,6 +16,7 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmDocumentCompileDefinitions.h"
+#include "cmDocumentGeneratorExpressions.h"
#include "cmDocumentLocationUndefined.h"
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
@@ -56,6 +57,7 @@ struct cmTarget::OutputInfo
{
std::string OutDir;
std::string ImpDir;
+ std::string PdbDir;
};
//----------------------------------------------------------------------------
@@ -204,6 +206,9 @@ void cmTarget::DefineProperties(cmake *cm)
"are not supported by the native build tool. "
"The VS6 IDE does not support definition values with spaces "
"(but NMake does).\n"
+ "Contents of COMPILE_DEFINITIONS may use \"generator expressions\" with "
+ "the syntax \"$<...>\". "
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
@@ -497,8 +502,11 @@ void cmTarget::DefineProperties(cmake *cm)
"to the include_directories command."
"\n"
"The target property values are used by the generators to set "
- "the include paths for the compiler. "
- "See also the include_directories command.");
+ "the include paths for the compiler. "
+ "See also the include_directories command.\n"
+ "Contents of INCLUDE_DIRECTORIES may use \"generator expressions\" with "
+ "the syntax \"$<...>\". "
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INSTALL_NAME_DIR", cmProperty::TARGET,
@@ -740,6 +748,22 @@ void cmTarget::DefineProperties(cmake *cm)
"Use OUTPUT_NAME_<CONFIG> instead.");
cm->DefineProperty
+ ("PDB_NAME", cmProperty::TARGET,
+ "Output name for MS debug symbols .pdb file.",
+ "Set the base name for debug symbols file created for an "
+ "executable or library target. "
+ "If not set, the logical target name is used by default. "
+ "\n"
+ "This property is not implemented by the Visual Studio 6 generator.");
+
+ cm->DefineProperty
+ ("PDB_NAME_<CONFIG>", cmProperty::TARGET,
+ "Per-configuration name for MS debug symbols .pdb file. ",
+ "This is the configuration-specific version of PDB_NAME. "
+ "\n"
+ "This property is not implemented by the Visual Studio 6 generator.");
+
+ cm->DefineProperty
("PRE_INSTALL_SCRIPT", cmProperty::TARGET,
"Deprecated install support.",
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
@@ -1189,6 +1213,27 @@ void cmTarget::DefineProperties(cmake *cm)
CM_TARGET_OUTDIR_CONFIG_DOC(RUNTIME));
cm->DefineProperty
+ ("PDB_OUTPUT_DIRECTORY", cmProperty::TARGET,
+ "Output directory for MS debug symbols .pdb files.",
+ "This property specifies the directory into which the MS debug symbols "
+ "will be placed. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_PDB_OUTPUT_DIRECTORY if it is set when a target is created."
+ "\n"
+ "This property is not implemented by the Visual Studio 6 generator.");
+ cm->DefineProperty
+ ("PDB_OUTPUT_DIRECTORY_<CONFIG>", cmProperty::TARGET,
+ "Per-configuration output directory for MS debug symbols .pdb files.",
+ "This is a per-configuration version of PDB_OUTPUT_DIRECTORY, "
+ "but multi-configuration generators (VS, Xcode) do NOT append "
+ "a per-configuration subdirectory to the specified directory. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> "
+ "if it is set when a target is created."
+ "\n"
+ "This property is not implemented by the Visual Studio 6 generator.");
+
+ cm->DefineProperty
("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET,
"Output name for ARCHIVE target files.",
"This property specifies the base name for archive target files. "
@@ -1262,6 +1307,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
+ this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("Fortran_FORMAT", 0);
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
this->SetPropertyDefault("GNUtoMS", 0);
@@ -1281,6 +1327,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
"ARCHIVE_OUTPUT_DIRECTORY_",
"LIBRARY_OUTPUT_DIRECTORY_",
"RUNTIME_OUTPUT_DIRECTORY_",
+ "PDB_OUTPUT_DIRECTORY_",
0};
for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
@@ -2013,9 +2060,8 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname)
}
//----------------------------------------------------------------------------
-bool cmTarget::AddFramework(const std::string& libname, LinkLibraryType llt)
+bool cmTarget::AddFramework(const std::string& libname, LinkLibraryType)
{
- (void)llt; // TODO: What is this?
if(this->NameResolvesToFramework(libname.c_str()))
{
std::string frameworkDir = libname;
@@ -2295,7 +2341,7 @@ void cmTarget::Emit(const LibraryID lib,
// be preserved.
// This variable will keep track of the libraries that were
- // emitted directory from the current node, and not from a
+ // emitted directly from the current node, and not from a
// recursive call. This way, if we come across a library that
// has already been emitted, we repeat it iff it has been
// emitted here.
@@ -2413,7 +2459,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
//----------------------------------------------------------------------------
void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
{
- // Wipe wipe out maps caching information affected by this property.
+ // Wipe out maps caching information affected by this property.
if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
{
this->Internal->ImportInfoMap.clear();
@@ -2538,6 +2584,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config)
OutputInfo info;
this->ComputeOutputDir(config, false, info.OutDir);
this->ComputeOutputDir(config, true, info.ImpDir);
+ this->ComputePDBOutputDir(config, info.PdbDir);
OutputInfoMapType::value_type entry(config_upper, info);
i = this->Internal->OutputInfoMap.insert(entry).first;
}
@@ -2563,6 +2610,17 @@ std::string cmTarget::GetDirectory(const char* config, bool implib)
}
//----------------------------------------------------------------------------
+std::string cmTarget::GetPDBDirectory(const char* config)
+{
+ if(OutputInfo const* info = this->GetOutputInfo(config))
+ {
+ // Return the directory in which the target will be built.
+ return info->PdbDir;
+ }
+ return "";
+}
+
+//----------------------------------------------------------------------------
const char* cmTarget::GetLocation(const char* config)
{
if (this->IsImported())
@@ -3008,6 +3066,28 @@ std::string cmTarget::GetPDBName(const char* config)
std::string base;
std::string suffix;
this->GetFullNameInternal(config, false, prefix, base, suffix);
+
+ std::vector<std::string> props;
+ std::string configUpper =
+ cmSystemTools::UpperCase(config? config : "");
+ if(!configUpper.empty())
+ {
+ // PDB_NAME_<CONFIG>
+ props.push_back("PDB_NAME_" + configUpper);
+ }
+
+ // PDB_NAME
+ props.push_back("PDB_NAME");
+
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
+ {
+ if(const char* outName = this->GetProperty(i->c_str()))
+ {
+ base = outName;
+ break;
+ }
+ }
return prefix+base+".pdb";
}
@@ -3392,7 +3472,7 @@ void cmTarget::GetLibraryNames(std::string& name,
}
// The program database file name.
- pdbName = prefix+base+".pdb";
+ pdbName = this->GetPDBName(config);
}
//----------------------------------------------------------------------------
@@ -3471,7 +3551,7 @@ void cmTarget::GetExecutableNames(std::string& name,
impName = this->GetFullNameInternal(config, true);
// The program database file name.
- pdbName = prefix+base+".pdb";
+ pdbName = this->GetPDBName(config);
}
//----------------------------------------------------------------------------
@@ -3550,7 +3630,7 @@ void cmTarget::GenerateTargetManifest(const char* config)
}
if(!pdbName.empty())
{
- f = dir;
+ f = this->GetPDBDirectory(config);
f += "/";
f += pdbName;
gg->AddToManifest(config? config:"", f);
@@ -3860,6 +3940,65 @@ bool cmTarget::ComputeOutputDir(const char* config,
}
//----------------------------------------------------------------------------
+void cmTarget::ComputePDBOutputDir(const char* config, std::string& out)
+{
+ // Look for a target property defining the target output directory
+ // based on the target type.
+ std::string targetTypeName = "PDB";
+ const char* propertyName = 0;
+ std::string propertyNameStr = targetTypeName;
+ if(!propertyNameStr.empty())
+ {
+ propertyNameStr += "_OUTPUT_DIRECTORY";
+ propertyName = propertyNameStr.c_str();
+ }
+
+ // Check for a per-configuration output directory target property.
+ std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ const char* configProp = 0;
+ std::string configPropStr = targetTypeName;
+ if(!configPropStr.empty())
+ {
+ configPropStr += "_OUTPUT_DIRECTORY_";
+ configPropStr += configUpper;
+ configProp = configPropStr.c_str();
+ }
+
+ // Select an output directory.
+ if(const char* config_outdir = this->GetProperty(configProp))
+ {
+ // Use the user-specified per-configuration output directory.
+ out = config_outdir;
+
+ // Skip per-configuration subdirectory.
+ config = 0;
+ }
+ else if(const char* outdir = this->GetProperty(propertyName))
+ {
+ // Use the user-specified output directory.
+ out = outdir;
+ }
+ if(out.empty())
+ {
+ // Default to the current output directory.
+ out = ".";
+ }
+
+ // Convert the output path to a full path in case it is
+ // specified as a relative path. Treat a relative path as
+ // relative to the current output directory for this makefile.
+ out = (cmSystemTools::CollapseFullPath
+ (out.c_str(), this->Makefile->GetStartOutputDirectory()));
+
+ // The generator may add the configuration's subdirectory.
+ if(config && *config)
+ {
+ this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
+ AppendDirectoryForConfig("/", config, "", out);
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib)
{
std::string dir;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1f6bb46..558bfab 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -291,6 +291,12 @@ public:
output directory is given. */
std::string GetDirectory(const char* config = 0, bool implib = false);
+ /** Get the directory in which this targets .pdb files will be placed.
+ If the configuration name is given then the generator will add its
+ subdirectory for that configuration. Otherwise just the canonical
+ pdb output directory is given. */
+ std::string GetPDBDirectory(const char* config = 0);
+
/** Get the location of the target in the build tree for the given
configuration. This location is suitable for use as the LOCATION
target property. */
@@ -571,6 +577,7 @@ private:
struct OutputInfo;
OutputInfo const* GetOutputInfo(const char* config);
bool ComputeOutputDir(const char* config, bool implib, std::string& out);
+ void ComputePDBOutputDir(const char* config, std::string& out);
// Cache import information from properties for each configuration.
struct ImportInfo;
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
new file mode 100644
index 0000000..c9d87fb
--- /dev/null
+++ b/Source/cmTargetExport.h
@@ -0,0 +1,39 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmTargetExport_h
+#define cmTargetExport_h
+
+class cmTarget;
+class cmInstallTargetGenerator;
+class cmInstallFilesGenerator;
+
+/** \brief A member of an ExportSet
+ *
+ * This struct holds pointers to target and all relevant generators.
+ */
+class cmTargetExport
+{
+public:
+ cmTarget* Target; ///< The target
+
+ ///@name Generators
+ ///@{
+ cmInstallTargetGenerator* ArchiveGenerator;
+ cmInstallTargetGenerator* RuntimeGenerator;
+ cmInstallTargetGenerator* LibraryGenerator;
+ cmInstallTargetGenerator* FrameworkGenerator;
+ cmInstallTargetGenerator* BundleGenerator;
+ cmInstallFilesGenerator* HeaderGenerator;
+ ///@}
+};
+
+#endif
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index dbea1c3..f42b0f6 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -108,8 +108,8 @@ bool cmTargetLinkLibrariesCommand
// specification if the keyword is encountered as the first argument.
this->CurrentProcessingState = ProcessingLinkLibraries;
- // add libraries, nothe that there is an optional prefix
- // of debug and optimized than can be used
+ // add libraries, note that there is an optional prefix
+ // of debug and optimized that can be used
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "LINK_INTERFACE_LIBRARIES")
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 90718ab..ab57a32 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1279,9 +1279,8 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
{
- // TODO: PDB for object library?
this->WriteString("<ProgramDataBaseFileName>", 3);
- *this->BuildFileStream << this->Target->GetDirectory(configName.c_str())
+ *this->BuildFileStream << this->Target->GetPDBDirectory(configName.c_str())
<< "/"
<< this->Target->GetPDBName(configName.c_str())
<< "</ProgramDataBaseFileName>\n";
@@ -1506,9 +1505,8 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
config.c_str());
}
- std::string dir = this->Target->GetDirectory(config.c_str());
- dir += "/";
- std::string pdb = dir;
+ std::string pdb = this->Target->GetPDBDirectory(config.c_str());
+ pdb += "/";
pdb += targetNamePDB;
std::string imLib = this->Target->GetDirectory(config.c_str(), true);
imLib += "/";
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e03b926..ae69ce8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1254,6 +1254,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(CMAKE_TEST_MSVC)
ADD_TEST_MACRO(ForceInclude foo)
+ ADD_TEST_MACRO(PDBDirectoryAndName myexe)
ADD_TEST_MACRO(PrecompiledHeader foo)
endif()
if(CMAKE_TEST_MSVC OR
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index f118c30..e19ab88 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -87,6 +87,18 @@ target_link_libraries(testLibCycleA testLibCycleB)
target_link_libraries(testLibCycleB testLibCycleA)
set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
+# Test exporting dependent libraries into different exports
+add_library(testLibRequired testLibRequired.c)
+add_library(testLibDepends testLibDepends.c)
+target_link_libraries(testLibDepends testLibRequired)
+
+install(TARGETS testLibRequired EXPORT RequiredExp DESTINATION lib )
+install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredConfig.cmake DESTINATION lib/cmake/testLibRequired)
+
+install(TARGETS testLibDepends EXPORT DependsExp DESTINATION lib )
+install(EXPORT DependsExp FILE testLibDependsConfig.cmake DESTINATION lib/cmake/testLibDepends)
+
+
# Install and export from install tree.
install(
TARGETS
diff --git a/Tests/ExportImport/Export/testLibDepends.c b/Tests/ExportImport/Export/testLibDepends.c
new file mode 100644
index 0000000..2849b33
--- /dev/null
+++ b/Tests/ExportImport/Export/testLibDepends.c
@@ -0,0 +1,4 @@
+
+extern int testLibRequired(void);
+
+int testLibDepends(void) { return testLibRequired(); }
diff --git a/Tests/ExportImport/Export/testLibRequired.c b/Tests/ExportImport/Export/testLibRequired.c
new file mode 100644
index 0000000..e126d44
--- /dev/null
+++ b/Tests/ExportImport/Export/testLibRequired.c
@@ -0,0 +1 @@
+int testLibRequired(void) { return 0; }
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 650af6a..8841792 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -4,6 +4,10 @@ include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake)
# Import targets from the exported install tree.
include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake)
+# Import two exports, where the Depends one depends on an exported target from the Required one:
+include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibRequired/testLibRequiredConfig.cmake)
+include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibDepends/testLibDependsConfig.cmake)
+
# Try referencing an executable imported from the install tree.
add_custom_command(
OUTPUT ${Import_BINARY_DIR}/exp_generated.c
diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt
new file mode 100644
index 0000000..bc2f013
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/CMakeLists.txt
@@ -0,0 +1,79 @@
+cmake_minimum_required(VERSION 2.8)
+project(PDBDirectoryAndName C)
+
+# Make sure the proper compiler is in use.
+if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
+ message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel")
+endif()
+
+set(my_targets "")
+
+add_library(mylibA SHARED mylibA.c)
+set_target_properties(mylibA PROPERTIES
+ PDB_NAME "mylibA_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB"
+)
+list(APPEND my_targets mylibA)
+
+add_library(mylibB STATIC mylibB.c)
+set_target_properties(mylibB PROPERTIES
+ PDB_NAME "mylibB_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB"
+)
+list(APPEND my_targets mylibB)
+
+add_library(mylibC SHARED mylibC.c)
+set_target_properties(mylibC PROPERTIES
+ PDB_NAME "mylibC_Special"
+)
+list(APPEND my_targets mylibC)
+
+add_library(mylibD STATIC mylibD.c)
+set_target_properties(mylibD PROPERTIES
+ PDB_NAME "mylibD_Special"
+)
+list(APPEND my_targets mylibD)
+
+add_executable(myexe myexe.c)
+set_target_properties(myexe PROPERTIES
+ PDB_NAME "myexe_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/myexe_PDB"
+)
+list(APPEND my_targets myexe)
+
+target_link_libraries(myexe mylibA mylibB mylibC mylibD)
+
+add_executable(myexe2 myexe2.c)
+set_target_properties(myexe2 PROPERTIES
+ PDB_NAME "myexe2_Special"
+)
+list(APPEND my_targets myexe2)
+
+target_link_libraries(myexe2 mylibA mylibD)
+
+#-----------------------------------------------------------------------------
+# Check that PDB files actually appear where expected.
+
+# The PDB_NAME and PDB_OUTPUT_DIRECTORY options do not work in VS 6.
+if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
+ return()
+endif()
+# PDB output not fully implemented for Intel
+if("${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
+ return()
+endif()
+
+set(pdbs "")
+foreach(t ${my_targets})
+ get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME)
+ get_property(pdb_dir TARGET ${t} PROPERTY PDB_OUTPUT_DIRECTORY)
+ if(NOT pdb_dir)
+ set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+ list(APPEND pdbs ${pdb_dir}/${CMAKE_CFG_INTDIR}/${pdb_name}.pdb)
+endforeach()
+add_custom_target(check_pdbs ALL VERBATIM
+ COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIGURATION> "-Dpdbs=${pdbs}"
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check_pdbs.cmake
+ )
+add_dependencies(check_pdbs ${my_targets})
diff --git a/Tests/PDBDirectoryAndName/check_pdbs.cmake b/Tests/PDBDirectoryAndName/check_pdbs.cmake
new file mode 100644
index 0000000..89cdb3c
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/check_pdbs.cmake
@@ -0,0 +1,10 @@
+if(NOT "${config}" MATCHES "[Dd][Ee][Bb]")
+ return()
+endif()
+foreach(pdb ${pdbs})
+ if(EXISTS "${pdb}")
+ message(STATUS "PDB Exists: ${pdb}")
+ else()
+ message(SEND_ERROR "PDB MISSING: ${pdb}")
+ endif()
+endforeach()
diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c
new file mode 100644
index 0000000..c6d9065
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/myexe.c
@@ -0,0 +1,5 @@
+extern int mylibA();
+extern int mylibB();
+extern int mylibC();
+extern int mylibD();
+int main() { return mylibA() + mylibB() + mylibC() + mylibD(); }
diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c
new file mode 100644
index 0000000..75b39cd
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/myexe2.c
@@ -0,0 +1,3 @@
+extern int mylibA();
+extern int mylibD();
+int main() { return mylibA() + mylibD(); }
diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c
new file mode 100644
index 0000000..f4c553f
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibA.c
@@ -0,0 +1 @@
+__declspec(dllexport) int mylibA() { return 1; }
diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c
new file mode 100644
index 0000000..2040c67
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibB.c
@@ -0,0 +1 @@
+int mylibB() { return -1; }
diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c
new file mode 100644
index 0000000..adf7c70
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibC.c
@@ -0,0 +1 @@
+__declspec(dllexport) int mylibC() { return 1; }
diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c
new file mode 100644
index 0000000..efa8a82
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibD.c
@@ -0,0 +1 @@
+int mylibD() { return -1; }
diff --git a/bootstrap b/bootstrap
index 1466a40..713f01f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -199,6 +199,8 @@ CMAKE_CXX_SOURCES="\
cmMakefile \
cmExportFileGenerator \
cmExportInstallFileGenerator \
+ cmExportSet \
+ cmExportSetMap \
cmInstallDirectoryGenerator \
cmGeneratedFileStream \
cmGeneratorTarget \