summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst11
-rw-r--r--Help/release/dev/ExternalProject-add-lzma.rst5
-rw-r--r--Help/release/dev/cpack-add-lzma.rst5
-rw-r--r--Modules/ExternalProject.cmake10
-rw-r--r--Modules/Platform/Windows-MSVC.cmake1
-rw-r--r--Modules/Platform/Windows-df.cmake1
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPack7zGenerator.cxx25
-rw-r--r--Source/CPack/cmCPack7zGenerator.h36
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx12
-rw-r--r--Source/CPack/cmCPackTXZGenerator.cxx25
-rw-r--r--Source/CPack/cmCPackTXZGenerator.h35
-rw-r--r--Source/cmArchiveWrite.cxx10
-rw-r--r--Source/cmArchiveWrite.h3
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx125
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx7
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx69
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h6
-rw-r--r--Tests/RunCMake/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake17
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake19
30 files changed, 406 insertions, 70 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index bc24798..77259a0 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -148,6 +148,17 @@ than 4.2.0.
Name of file with soname (.so.3).
``$<TARGET_SONAME_FILE_DIR:tgt>``
Directory of with soname (.so.3).
+``$<TARGET_PDB_FILE:tgt>``
+ Full path to the linker generated program database file (.pdb)
+ where ``tgt`` is the name of a target.
+
+ See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
+ target properties and their configuration specific variants
+ :prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`.
+``$<TARGET_PDB_FILE_NAME:tgt>``
+ Name of the linker generated program database file (.pdb).
+``$<TARGET_PDB_FILE_DIR:tgt>``
+ Directory of the linker generated program database file (.pdb).
``$<TARGET_PROPERTY:tgt,prop>``
Value of the property ``prop`` on the target ``tgt``.
diff --git a/Help/release/dev/ExternalProject-add-lzma.rst b/Help/release/dev/ExternalProject-add-lzma.rst
new file mode 100644
index 0000000..cb398ef
--- /dev/null
+++ b/Help/release/dev/ExternalProject-add-lzma.rst
@@ -0,0 +1,5 @@
+ExternalProject-add-lzma
+------------------------
+
+* The :module:`ExternalProject` module learned to support lzma-compressed
+ source tarballs with ``.7z``, ``.tar.xz``, and ``.txz`` extensions.
diff --git a/Help/release/dev/cpack-add-lzma.rst b/Help/release/dev/cpack-add-lzma.rst
new file mode 100644
index 0000000..ad59f35
--- /dev/null
+++ b/Help/release/dev/cpack-add-lzma.rst
@@ -0,0 +1,5 @@
+cpack-add-lzma
+--------------
+
+* :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting
+ lzma-compressed archives.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0d35cca..dbce9f4 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -737,7 +737,7 @@ endfunction()
function(_ep_write_extractfile_script script_filename name filename directory)
set(args "")
- if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
+ if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
set(args xfz)
endif()
@@ -746,7 +746,7 @@ function(_ep_write_extractfile_script script_filename name filename directory)
endif()
if(args STREQUAL "")
- message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip")
+ message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip")
return()
endif()
@@ -1540,11 +1540,11 @@ function(_ep_add_download_command name)
if("x${fname}" STREQUAL "x")
string(REGEX MATCH "[^/\\?]*$" fname "${url}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
- string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}")
+ if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
+ string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}")
set(fname "${CMAKE_MATCH_1}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
+ if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
endif()
string(REPLACE ";" "-" fname "${fname}")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 2cfe6fe..e51c592 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -258,4 +258,5 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
endmacro()
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
index 8dfb610..211cc9d 100644
--- a/Modules/Platform/Windows-df.cmake
+++ b/Modules/Platform/Windows-df.cmake
@@ -26,7 +26,6 @@ set(CMAKE_Fortran_COMPILE_OBJECT
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
set(CMAKE_Fortran_LINK_EXECUTABLE
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index c394946..7f36bb2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -580,9 +580,11 @@ set(CPACK_SRCS
CPack/cmCPackIFWGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
CPack/cmCPackTGZGenerator.cxx
+ CPack/cmCPackTXZGenerator.cxx
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPack7zGenerator.cxx
)
if(CYGWIN)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 94f9919..ea892aa 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 20140729)
+set(CMake_VERSION_PATCH 20140731)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx
new file mode 100644
index 0000000..ce31ad4
--- /dev/null
+++ b/Source/CPack/cmCPack7zGenerator.cxx
@@ -0,0 +1,25 @@
+/*============================================================================
+ 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.
+============================================================================*/
+
+#include "cmCPack7zGenerator.h"
+
+//----------------------------------------------------------------------
+cmCPack7zGenerator::cmCPack7zGenerator()
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
+ cmArchiveWrite::Type7Zip)
+{
+}
+
+//----------------------------------------------------------------------
+cmCPack7zGenerator::~cmCPack7zGenerator()
+{
+}
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
new file mode 100644
index 0000000..f5a323f
--- /dev/null
+++ b/Source/CPack/cmCPack7zGenerator.h
@@ -0,0 +1,36 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmCPack7zGenerator_h
+#define cmCPack7zGenerator_h
+
+#include "cmCPackArchiveGenerator.h"
+
+/** \class cmCPack7zGenerator
+ * \brief A generator for 7z files
+ */
+class cmCPack7zGenerator : public cmCPackArchiveGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPack7zGenerator, cmCPackArchiveGenerator);
+
+ /**
+ * Construct generator
+ */
+ cmCPack7zGenerator();
+ virtual ~cmCPack7zGenerator();
+
+protected:
+ virtual const char* GetOutputExtension() { return ".7z"; }
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 788e785..da97657 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -14,9 +14,11 @@
#include "cmCPackGenerator.h"
#include "cmCPackTGZGenerator.h"
+#include "cmCPackTXZGenerator.h"
#include "cmCPackTarBZip2Generator.h"
#include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h"
+#include "cmCPack7zGenerator.h"
#include "cmCPackSTGZGenerator.h"
#include "cmCPackNSISGenerator.h"
#include "cmCPackIFWGenerator.h"
@@ -57,6 +59,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("TGZ", "Tar GZip compression",
cmCPackTGZGenerator::CreateGenerator);
}
+ if (cmCPackTXZGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("TXZ", "Tar XZ compression",
+ cmCPackTXZGenerator::CreateGenerator);
+ }
if (cmCPackSTGZGenerator::CanGenerate())
{
this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
@@ -92,6 +99,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator);
}
+ if (cmCPack7zGenerator::CanGenerate())
+ {
+ this->RegisterGenerator("7Z", "7-Zip file format",
+ cmCPack7zGenerator::CreateGenerator);
+ }
#ifdef _WIN32
if (cmCPackWIXGenerator::CanGenerate())
{
diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx
new file mode 100644
index 0000000..ecfc177
--- /dev/null
+++ b/Source/CPack/cmCPackTXZGenerator.cxx
@@ -0,0 +1,25 @@
+/*============================================================================
+ 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.
+============================================================================*/
+
+#include "cmCPackTXZGenerator.h"
+
+//----------------------------------------------------------------------
+cmCPackTXZGenerator::cmCPackTXZGenerator()
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ,
+ cmArchiveWrite::TypeTAR)
+{
+}
+
+//----------------------------------------------------------------------
+cmCPackTXZGenerator::~cmCPackTXZGenerator()
+{
+}
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
new file mode 100644
index 0000000..bf8152f
--- /dev/null
+++ b/Source/CPack/cmCPackTXZGenerator.h
@@ -0,0 +1,35 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmCPackTXZGenerator_h
+#define cmCPackTXZGenerator_h
+
+#include "cmCPackArchiveGenerator.h"
+
+/** \class cmCPackTXZGenerator
+ * \brief A generator for TXZ files
+ *
+ */
+class cmCPackTXZGenerator : public cmCPackArchiveGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPackTXZGenerator, cmCPackArchiveGenerator);
+ /**
+ * Construct generator
+ */
+ cmCPackTXZGenerator();
+ virtual ~cmCPackTXZGenerator();
+protected:
+ virtual const char* GetOutputExtension() { return ".tar.xz"; }
+};
+
+#endif
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 3b0ead5..a2aecac 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -159,7 +159,15 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
this->Error += cm_archive_error_string(this->Archive);
return;
}
- break;
+ break;
+ case Type7Zip:
+ if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK)
+ {
+ this->Error = "archive_write_set_format_7zip: ";
+ this->Error += cm_archive_error_string(this->Archive);
+ return;
+ }
+ break;
}
// do not pad the last block!!
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 3e3b2f0..a6dcc0e 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -42,7 +42,8 @@ public:
enum Type
{
TypeTAR,
- TypeZIP
+ TypeZIP,
+ Type7Zip
};
/** Construct with output stream to which to write archive. */
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7a53d65..35a9fcb 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1523,7 +1523,17 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
} installPrefixNode;
//----------------------------------------------------------------------------
-template<bool linker, bool soname>
+class ArtifactNameTag;
+class ArtifactLinkerTag;
+class ArtifactSonameTag;
+class ArtifactPdbTag;
+
+class ArtifactPathTag;
+class ArtifactDirTag;
+class ArtifactNameTag;
+
+//----------------------------------------------------------------------------
+template<typename ArtifactT>
struct TargetFilesystemArtifactResultCreator
{
static std::string Create(cmTarget* target,
@@ -1533,7 +1543,7 @@ struct TargetFilesystemArtifactResultCreator
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultCreator<false, true>
+struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
{
static std::string Create(cmTarget* target,
cmGeneratorExpressionContext *context,
@@ -1563,7 +1573,45 @@ struct TargetFilesystemArtifactResultCreator<false, true>
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultCreator<true, false>
+struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
+{
+ static std::string Create(cmTarget* target,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *content)
+ {
+ std::string language = target->GetLinkerLanguage(context->Config);
+
+ std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
+
+ if(!context->Makefile->IsOn(pdbSupportVar))
+ {
+ ::reportError(context, content->GetOriginalExpression(),
+ "TARGET_PDB_FILE is not supported by the target linker.");
+ return std::string();
+ }
+
+ cmTarget::TargetType targetType = target->GetType();
+
+ if(targetType != cmTarget::SHARED_LIBRARY &&
+ targetType != cmTarget::MODULE_LIBRARY &&
+ targetType != cmTarget::EXECUTABLE)
+ {
+ ::reportError(context, content->GetOriginalExpression(),
+ "TARGET_PDB_FILE is allowed only for "
+ "targets with linker created artifacts.");
+ return std::string();
+ }
+
+ std::string result = target->GetPDBDirectory(context->Config);
+ result += "/";
+ result += target->GetPDBName(context->Config);
+ return result;
+ }
+};
+
+//----------------------------------------------------------------------------
+template<>
+struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
{
static std::string Create(cmTarget* target,
cmGeneratorExpressionContext *context,
@@ -1584,7 +1632,7 @@ struct TargetFilesystemArtifactResultCreator<true, false>
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultCreator<false, false>
+struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
{
static std::string Create(cmTarget* target,
cmGeneratorExpressionContext *context,
@@ -1596,7 +1644,7 @@ struct TargetFilesystemArtifactResultCreator<false, false>
//----------------------------------------------------------------------------
-template<bool dirQual, bool nameQual>
+template<typename ArtifactT>
struct TargetFilesystemArtifactResultGetter
{
static std::string Get(const std::string &result);
@@ -1604,7 +1652,7 @@ struct TargetFilesystemArtifactResultGetter
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultGetter<false, true>
+struct TargetFilesystemArtifactResultGetter<ArtifactNameTag>
{
static std::string Get(const std::string &result)
{ return cmSystemTools::GetFilenameName(result); }
@@ -1612,7 +1660,7 @@ struct TargetFilesystemArtifactResultGetter<false, true>
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultGetter<true, false>
+struct TargetFilesystemArtifactResultGetter<ArtifactDirTag>
{
static std::string Get(const std::string &result)
{ return cmSystemTools::GetFilenamePath(result); }
@@ -1620,14 +1668,14 @@ struct TargetFilesystemArtifactResultGetter<true, false>
//----------------------------------------------------------------------------
template<>
-struct TargetFilesystemArtifactResultGetter<false, false>
+struct TargetFilesystemArtifactResultGetter<ArtifactPathTag>
{
static std::string Get(const std::string &result)
{ return result; }
};
//----------------------------------------------------------------------------
-template<bool linker, bool soname, bool dirQual, bool nameQual>
+template<typename ArtifactT, typename ComponentT>
struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
{
TargetFilesystemArtifact() {}
@@ -1675,7 +1723,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
context->AllTargets.insert(target);
std::string result =
- TargetFilesystemArtifactResultCreator<linker, soname>::Create(
+ TargetFilesystemArtifactResultCreator<ArtifactT>::Create(
target,
context,
content);
@@ -1684,29 +1732,35 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
return std::string();
}
return
- TargetFilesystemArtifactResultGetter<dirQual, nameQual>::Get(result);
+ TargetFilesystemArtifactResultGetter<ComponentT>::Get(result);
}
};
//----------------------------------------------------------------------------
+template<typename ArtifactT>
+struct TargetFilesystemArtifactNodeGroup
+{
+ TargetFilesystemArtifactNodeGroup()
+ {
+ }
+
+ TargetFilesystemArtifact<ArtifactT, ArtifactPathTag> File;
+ TargetFilesystemArtifact<ArtifactT, ArtifactNameTag> FileName;
+ TargetFilesystemArtifact<ArtifactT, ArtifactDirTag> FileDir;
+};
+
+//----------------------------------------------------------------------------
static const
-TargetFilesystemArtifact<false, false, false, false> targetFileNode;
-static const
-TargetFilesystemArtifact<true, false, false, false> targetLinkerFileNode;
-static const
-TargetFilesystemArtifact<false, true, false, false> targetSoNameFileNode;
-static const
-TargetFilesystemArtifact<false, false, false, true> targetFileNameNode;
-static const
-TargetFilesystemArtifact<true, false, false, true> targetLinkerFileNameNode;
-static const
-TargetFilesystemArtifact<false, true, false, true> targetSoNameFileNameNode;
+TargetFilesystemArtifactNodeGroup<ArtifactNameTag> targetNodeGroup;
+
static const
-TargetFilesystemArtifact<false, false, true, false> targetFileDirNode;
+TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag> targetLinkerNodeGroup;
+
static const
-TargetFilesystemArtifact<true, false, true, false> targetLinkerFileDirNode;
+TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> targetSoNameNodeGroup;
+
static const
-TargetFilesystemArtifact<false, true, true, false> targetSoNameFileDirNode;
+TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> targetPdbNodeGroup;
//----------------------------------------------------------------------------
static const
@@ -1732,15 +1786,18 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode;
nodeMap["CONFIGURATION"] = &configurationNode;
nodeMap["CONFIG"] = &configurationTestNode;
- nodeMap["TARGET_FILE"] = &targetFileNode;
- nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode;
- nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode;
- nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode;
- nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode;
- nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode;
- nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode;
- nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode;
- nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode;
+ nodeMap["TARGET_FILE"] = &targetNodeGroup.File;
+ nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File;
+ nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File;
+ nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File;
+ nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName;
+ nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName;
+ nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName;
+ nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName;
+ nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir;
+ nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir;
+ nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir;
+ nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir;
nodeMap["STREQUAL"] = &strEqualNode;
nodeMap["EQUAL"] = &equalNode;
nodeMap["LOWER_CASE"] = &lowerCaseNode;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 15a1b32..e344df4 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -187,12 +187,7 @@ cmNinjaNormalTargetGenerator
responseFlag += rspfile;
// build response file content
- std::string linkOptionVar = cmakeVarLang;
- linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_";
- linkOptionVar += cmTarget::GetTargetTypeName(targetType);
- const std::string linkOption =
- GetMakefile()->GetSafeDefinition(linkOptionVar);
- rspcontent = "$in_newline "+linkOption+" $LINK_PATH $LINK_LIBRARIES";
+ rspcontent = "$in_newline $LINK_PATH $LINK_LIBRARIES";
vars.Objects = responseFlag.c_str();
vars.LinkLibraries = "";
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5674317..d9013e0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -997,8 +997,42 @@ WriteGroupSources(const char* name,
this->WriteString("</ItemGroup>\n", 1);
}
+void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf)
+{
+ if(this->IsResxHeader(sf->GetFullPath()))
+ {
+ this->WriteSource("ClInclude", sf, ">\n");
+ this->WriteString("<FileType>CppForm</FileType>\n", 3);
+ this->WriteString("</ClInclude>\n", 2);
+ }
+ else
+ {
+ this->WriteSource("ClInclude", sf);
+ }
+}
+
+void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
+{
+ std::string tool = "None";
+ std::string const& ext = sf->GetExtension();
+ if(ext == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
+ else if(ext == "jpg" ||
+ ext == "png")
+ {
+ tool = "Image";
+ }
+ else if(ext == "xml")
+ {
+ tool = "XML";
+ }
+ this->WriteSource(tool, sf);
+}
+
void cmVisualStudio10TargetGenerator::WriteSource(
- const char* tool, cmSourceFile const* sf, const char* end)
+ std::string const& tool, cmSourceFile const* sf, const char* end)
{
// Visual Studio tools append relative paths to the current dir, as in:
//
@@ -1036,26 +1070,15 @@ void cmVisualStudio10TargetGenerator::WriteSource(
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
(*this->BuildFileStream ) << tool << " Include=\""
- << cmVS10EscapeXML(sourceFile) << "\"";
-
- if(sf->GetExtension() == "h" &&
- this->IsResxHeader(sf->GetFullPath()))
- {
- (*this->BuildFileStream ) << ">\n";
- this->WriteString("<FileType>CppForm</FileType>\n", 3);
- this->WriteString("</ClInclude>\n", 2);
- }
- else
- {
- (*this->BuildFileStream ) << (end? end : " />\n");
- }
+ << cmVS10EscapeXML(sourceFile) << "\""
+ << (end? end : " />\n");
ToolSource toolSource = {sf, forceRelative};
this->Tools[tool].push_back(toolSource);
}
void cmVisualStudio10TargetGenerator::WriteSources(
- const char* tool, std::vector<cmSourceFile const*> const& sources)
+ std::string const& tool, std::vector<cmSourceFile const*> const& sources)
{
for(std::vector<cmSourceFile const*>::const_iterator
si = sources.begin(); si != sources.end(); ++si)
@@ -1074,7 +1097,11 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources, "");
- this->WriteSources("ClInclude", headerSources);
+ for(std::vector<cmSourceFile const*>::const_iterator
+ si = headerSources.begin(); si != headerSources.end(); ++si)
+ {
+ this->WriteHeaderSource(*si);
+ }
std::vector<cmSourceFile const*> idlSources;
this->GeneratorTarget->GetIDLSources(idlSources, "");
this->WriteSources("Midl", idlSources);
@@ -1086,7 +1113,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
si != objectSources.end(); ++si)
{
const std::string& lang = (*si)->GetLanguage();
- const char* tool = NULL;
+ std::string tool;
if (lang == "C"|| lang == "CXX")
{
tool = "ClCompile";
@@ -1101,7 +1128,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
tool = "ResourceCompile";
}
- if (tool)
+ if (!tool.empty())
{
this->WriteSource(tool, *si, " ");
if (this->OutputSourceSpecificFlags(*si))
@@ -1157,7 +1184,11 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
std::vector<cmSourceFile const*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources, "");
- this->WriteSources("None", extraSources);
+ for(std::vector<cmSourceFile const*>::const_iterator
+ si = extraSources.begin(); si != extraSources.end(); ++si)
+ {
+ this->WriteExtraSource(*si);
+ }
// Add object library contents as external objects.
std::vector<std::string> objs;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 7a329cb..7436372 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -57,9 +57,11 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteMSToolConfigurationValues(std::string const& config);
- void WriteSource(const char* tool, cmSourceFile const* sf,
+ void WriteHeaderSource(cmSourceFile const* sf);
+ void WriteExtraSource(cmSourceFile const* sf);
+ void WriteSource(std::string const& tool, cmSourceFile const* sf,
const char* end = 0);
- void WriteSources(const char* tool,
+ void WriteSources(std::string const& tool,
std::vector<cmSourceFile const*> const&);
void WriteAllSources();
void WriteDotNetReferences();
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index ff3b9a0..3cd9947 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -21,6 +21,12 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
set(File_Generate_ARGS -DXCODE_BELOW_2=1)
endif()
+# Test MSVC for older host CMake versions, and test
+# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
+if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
+ set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1)
+endif()
+
add_RunCMake_test(CMP0019)
add_RunCMake_test(CMP0022)
add_RunCMake_test(CMP0026)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..831edad
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_FILE:empty>
+
+ TARGET_PDB_FILE is not supported by the target linker.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..84a2b2e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_FILE:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..e5f21e2
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_FILE:empty>
+
+ TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..84a2b2e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_FILE:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index c8f3fdf..6c32393 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -16,3 +16,10 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION)
run_cmake(NonValidTarget-CXX_COMPILER_VERSION)
run_cmake(NonValidTarget-TARGET_PROPERTY)
run_cmake(NonValidTarget-TARGET_POLICY)
+
+if(LINKER_SUPPORTS_PDB)
+ run_cmake(NonValidTarget-TARGET_PDB_FILE)
+ run_cmake(ValidTarget-TARGET_PDB_FILE)
+else()
+ run_cmake(NonValidCompiler-TARGET_PDB_FILE)
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
new file mode 100644
index 0000000..748d14f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
@@ -0,0 +1,17 @@
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT)
+
+list(GET TEST_TXT 0 PDB_PATH)
+list(GET TEST_TXT 1 PDB_NAME)
+list(GET TEST_TXT 2 PDB_DIR)
+
+if(NOT PDB_PATH MATCHES "empty\\.pdb")
+ message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]")
+endif()
+
+if(NOT PDB_NAME STREQUAL "empty.pdb")
+ message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]")
+endif()
+
+if(PDB_DIR MATCHES "empty\\.pdb")
+ message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..38e47f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake
@@ -0,0 +1,19 @@
+
+enable_language(C)
+
+add_library(empty SHARED empty.c)
+
+if(CMAKE_CONFIGURATION_TYPES)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG)
+ set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>)
+endif()
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT
+[[$<TARGET_PDB_FILE:empty>
+$<TARGET_PDB_FILE_NAME:empty>
+$<TARGET_PDB_FILE_DIR:empty>
+]]
+ ${GENERATE_CONDITION}
+)