summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/vim/syntax/cmake.vim2
-rw-r--r--Help/release/dev/ExternalProject-HTTP_HEADER.rst5
-rw-r--r--Help/release/dev/cpack.hash_computing.rst5
-rw-r--r--Help/release/dev/ifw-package-resources.rst6
-rw-r--r--Modules/CPack.cmake9
-rw-r--r--Modules/CPackIFW.cmake32
-rw-r--r--Modules/ExternalProject-download.cmake.in1
-rw-r--r--Modules/ExternalProject.cmake18
-rw-r--r--Modules/FindCUDA.cmake13
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx13
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx84
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx33
-rw-r--r--Source/cmCommonTargetGenerator.cxx12
-rw-r--r--Source/cmCommonTargetGenerator.h4
-rw-r--r--Source/cmDependsC.cxx17
-rw-r--r--Source/cmDependsFortran.cxx63
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx36
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
-rw-r--r--Source/cmListFileCache.cxx8
-rw-r--r--Source/cmLocalCommonGenerator.cxx10
-rw-r--r--Source/cmLocalCommonGenerator.h9
-rw-r--r--Source/cmLocalGenerator.cxx16
-rw-r--r--Source/cmLocalNinjaGenerator.cxx13
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx42
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx18
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx47
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx59
-rw-r--r--Source/cmMakefileTargetGenerator.cxx110
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx9
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx3
-rw-r--r--Source/cmOutputConverter.cxx39
-rw-r--r--Source/cmOutputConverter.h26
-rw-r--r--Source/cmServer.cxx19
-rw-r--r--Source/cmServer.h6
-rw-r--r--Source/cmServerProtocol.cxx5
-rw-r--r--Source/cmServerProtocol.h2
-rw-r--r--Source/cmTarget.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Source/cmcmd.cxx25
-rw-r--r--Tests/RunCMake/CPack/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake40
-rw-r--r--Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake4
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake14
-rw-r--r--Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt2
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/CommandLine/E_server-arg-stderr.txt2
-rw-r--r--Tests/Server/cmakelib.py2
58 files changed, 626 insertions, 320 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 53681a9..11b0fcb 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -44,7 +44,7 @@ syn keyword cmakeModule
\ contained
syn keyword cmakeKWExternalProject
- \ ALGO ALWAYS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE BYPRODUCTS CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS COMMAND COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_ CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DIRECTORY DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL EXCLUDE_FROM_MAIN FORCE GIT_REMOTE_NAME GIT_REPOSITORY GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG INDEPENDENT INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR STAMP_DIR STEP_TARGETS SVN_ SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH HTTP_USERNAME HTTP_PASSWORD USES_TERMINAL USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY _COMMAND _DIR
+ \ ALGO ALWAYS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE BYPRODUCTS CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS COMMAND COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_ CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DIRECTORY DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL EXCLUDE_FROM_MAIN FORCE GIT_REMOTE_NAME GIT_REPOSITORY GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG INDEPENDENT INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR STAMP_DIR STEP_TARGETS SVN_ SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH HTTP_USERNAME HTTP_PASSWORD HTTP_HEADER USES_TERMINAL USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY _COMMAND _DIR
\ contained
syn keyword cmakeKWadd_compile_options
diff --git a/Help/release/dev/ExternalProject-HTTP_HEADER.rst b/Help/release/dev/ExternalProject-HTTP_HEADER.rst
new file mode 100644
index 0000000..927d1b2
--- /dev/null
+++ b/Help/release/dev/ExternalProject-HTTP_HEADER.rst
@@ -0,0 +1,5 @@
+ExternalProject-HTTP_HEADER
+---------------------------
+
+* The :module:`ExternalProject` module gained a ``HTTP_HEADER``
+ option to add http download headers.
diff --git a/Help/release/dev/cpack.hash_computing.rst b/Help/release/dev/cpack.hash_computing.rst
new file mode 100644
index 0000000..9780bb2
--- /dev/null
+++ b/Help/release/dev/cpack.hash_computing.rst
@@ -0,0 +1,5 @@
+cpack.hash_computing
+--------------------
+
+* CPack gained a new :variable:`CPACK_PACKAGE_CHECKSUM` variable to
+ enable generation of a checksum file for each package file.
diff --git a/Help/release/dev/ifw-package-resources.rst b/Help/release/dev/ifw-package-resources.rst
new file mode 100644
index 0000000..28ea5c4
--- /dev/null
+++ b/Help/release/dev/ifw-package-resources.rst
@@ -0,0 +1,6 @@
+ifw-package-resources
+---------------------
+
+* The :module:`CPackIFW` module gained a new
+ :command:`cpack_ifw_add_package_resources` command to include additional
+ resources in the installer binary.
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 169a634..99f22ec 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -116,6 +116,15 @@
# A branding image that will be displayed inside the installer (used by GUI
# installers).
#
+# .. variable:: CPACK_PACKAGE_CHECKSUM
+#
+# An algorithm that will be used to generate additional file with checksum
+# of the package. Output file name will be::
+#
+# ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}
+#
+# Current supported alogorithms: MD5|SHA1|SHA224|SHA256|SHA384|SHA512.
+#
# .. variable:: CPACK_PROJECT_CONFIG_FILE
#
# CPack-time project CPack configuration file. This file included at cpack
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 36fc276..bb1285d 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -131,6 +131,14 @@
#
# Filename for a custom installer control script.
#
+# .. variable:: CPACK_IFW_PACKAGE_RESOURCES
+#
+# List of additional resources ('.qrc' files) to include in the installer
+# binary.
+#
+# You can use :command:`cpack_ifw_add_package_resources` command to resolve
+# relative paths.
+#
# .. variable:: CPACK_IFW_REPOSITORIES_ALL
#
# The list of remote repositories.
@@ -337,6 +345,19 @@
# ``DISPLAY_NAME``
# is string to display instead of the URL.
#
+#
+# .. command:: cpack_ifw_add_package_resources
+#
+# Add additional resources in the installer binary.
+#
+# ::
+#
+# cpack_ifw_add_package_resources(<file_path> <file_path> ...)
+#
+# This command will also add the specified files
+# to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`.
+#
+#
# Example usage
# ^^^^^^^^^^^^^
#
@@ -741,6 +762,17 @@ macro(cpack_ifw_update_repository reponame)
endmacro()
+# Macro for adding resources
+macro(cpack_ifw_add_package_resources)
+ set(_CPACK_IFW_PACKAGE_RESOURCES ${ARGV})
+ _cpack_ifw_resolve_file_list(_CPACK_IFW_PACKAGE_RESOURCES)
+ list(APPEND CPACK_IFW_PACKAGE_RESOURCES ${_CPACK_IFW_PACKAGE_RESOURCES})
+ set(_CPACK_IFWQRC_STR "list(APPEND CPACK_IFW_PACKAGE_RESOURCES \"${_CPACK_IFW_PACKAGE_RESOURCES}\")\n")
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWQRC_STR}")
+ endif()
+endmacro()
+
# Resolve package control script
_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
index 0e82adb..8e39a7e 100644
--- a/Modules/ExternalProject-download.cmake.in
+++ b/Modules/ExternalProject-download.cmake.in
@@ -136,6 +136,7 @@ foreach(i RANGE ${retry_number})
STATUS status
LOG log
@USERPWD_ARGS@
+ @HTTP_HEADERS_ARGS@
)
list(GET status 0 status_code)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 31fa459..79054a1 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -79,6 +79,8 @@ Create custom targets to build projects in external trees
Username for download operation
``HTTP_PASSWORD <username>``
Password for download operation
+ ``HTTP_HEADER <header>``
+ HTTP header for download operation. Suboption can be repeated several times.
``TLS_VERIFY <bool>``
Should certificate for https be checked
``TLS_CAINFO <file>``
@@ -862,7 +864,7 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers)
if(timeout)
set(TIMEOUT_ARGS TIMEOUT ${timeout})
set(TIMEOUT_MSG "${timeout} seconds")
@@ -916,6 +918,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
set(USERPWD_ARGS USERPWD "${userpwd}")
endif()
+ set(HTTP_HEADERS_ARGS "")
+ if(NOT http_headers STREQUAL "")
+ foreach(header ${http_headers})
+ set(
+ HTTP_HEADERS_ARGS
+ "HTTPHEADER \"${header}\"\n ${HTTP_HEADERS_ARGS}"
+ )
+ endforeach()
+ endif()
+
# Used variables:
# * TLS_VERIFY_CODE
# * TLS_CAINFO_CODE
@@ -927,6 +939,7 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
# * TIMEOUT_ARGS
# * TIMEOUT_MSG
# * USERPWD_ARGS
+ # * HTTP_HEADERS_ARGS
configure_file(
"${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in"
"${script_filename}"
@@ -1932,8 +1945,9 @@ function(_ep_add_download_command name)
get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME)
get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
+ get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
set(download_script "${stamp_dir}/download-${name}.cmake")
- _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}")
+ _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
if (no_extract)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index aaa1536..6b76c25 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -303,6 +303,8 @@
# CUDA_ADD_CUBLAS_TO_TARGET macro).
# CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library.
# Only available for CUDA version 5.5+
+# CUDA_cudadevrt_LIBRARY -- Device runtime library.
+# Required for separable compilation.
# CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library.
# Only available for CUDA version 4.0+.
# CUDA_curand_LIBRARY -- CUDA Random Number Generation library.
@@ -564,6 +566,7 @@ macro(cuda_unset_include_and_libraries)
unset(CUDA_CUDARTEMU_LIBRARY CACHE)
endif()
unset(CUDA_cudart_static_LIBRARY CACHE)
+ unset(CUDA_cudadevrt_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
unset(CUDA_cublas_device_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
@@ -794,6 +797,10 @@ else()
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY)
endif()
+if(NOT CUDA_VERSION VERSION_LESS "5.0")
+ cuda_find_library_local_first(CUDA_cudadevrt_LIBRARY cudadevrt "\"cudadevrt\" library")
+ mark_as_advanced(CUDA_cudadevrt_LIBRARY)
+endif()
if(CUDA_USE_STATIC_CUDA_RUNTIME)
if(UNIX)
@@ -1737,6 +1744,12 @@ macro(CUDA_ADD_LIBRARY cuda_target)
${CUDA_LIBRARIES}
)
+ if(CUDA_SEPARABLE_COMPILATION)
+ target_link_libraries(${cuda_target}
+ ${CUDA_cudadevrt_LIBRARY}
+ )
+ endif()
+
# We need to set the linker language based on what the expected generated file
# would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
set_target_properties(${cuda_target}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index dcce5e4..90d0d0e 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 6)
-set(CMake_VERSION_PATCH 20160919)
+set(CMake_VERSION_PATCH 20160920)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index a6f1585..fa7e0aa 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -130,6 +130,19 @@ int cmCPackIFWGenerator::PackageFiles()
{
std::string ifwCmd = BinCreator;
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
+
+ if (!Installer.Resources.empty()) {
+ ifwCmd += " -r ";
+ std::vector<std::string>::iterator it = Installer.Resources.begin();
+ std::string path = this->toplevel + "/resources/";
+ ifwCmd += path + *it;
+ ++it;
+ while (it != Installer.Resources.end()) {
+ ifwCmd += "," + path + *it;
+ ++it;
+ }
+ }
+
ifwCmd += " -p " + this->toplevel + "/packages";
if (!PkgsDirsVector.empty()) {
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 5a3efc9..aa609e2 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -13,11 +13,13 @@
#include "cmCPackIFWInstaller.h"
#include "CPack/cmCPackGenerator.h"
+#include "CPack/cmCPackLog.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
+#include "cmXMLParser.h"
#include "cmXMLWriter.h"
#include <cmConfigure.h>
@@ -198,8 +200,70 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) {
ControlScript = optIFW_CONTROL_SCRIPT;
}
+
+ // Resources
+ if (const char* optIFW_PACKAGE_RESOURCES =
+ this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
+ Resources.clear();
+ cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES, Resources);
+ }
}
+/** \class cmCPackIFWResourcesParser
+ * \brief Helper class that parse resources form .qrc (Qt)
+ */
+class cmCPackIFWResourcesParser : public cmXMLParser
+{
+public:
+ cmCPackIFWResourcesParser(cmCPackIFWInstaller* i)
+ : installer(i)
+ , file(false)
+ {
+ path = i->Directory + "/resources";
+ }
+
+ bool ParseResource(size_t r)
+ {
+ hasFiles = false;
+ hasErrors = false;
+
+ basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data());
+
+ ParseFile(installer->Resources[r].data());
+
+ return hasFiles && !hasErrors;
+ }
+
+ cmCPackIFWInstaller* installer;
+ bool file, hasFiles, hasErrors;
+ std::string path, basePath;
+
+protected:
+ void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
+ {
+ file = name == "file" ? true : false;
+ if (file) {
+ hasFiles = true;
+ }
+ }
+
+ void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
+ {
+ if (file) {
+ std::string content(data, data + length);
+ content = cmSystemTools::TrimWhitespace(content);
+ std::string source = basePath + "/" + content;
+ std::string destination = path + "/" + content;
+ if (!cmSystemTools::CopyFileIfDifferent(source.data(),
+ destination.data())) {
+ hasErrors = true;
+ }
+ }
+ }
+
+ void EndElement(const std::string& /*name*/) CM_OVERRIDE {}
+};
+
void cmCPackIFWInstaller::GenerateInstallerFile()
{
// Lazy directory initialization
@@ -315,6 +379,26 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.Element("ControlScript", name);
}
+ // Resources (copy to resources dir)
+ if (!Resources.empty()) {
+ std::vector<std::string> resources;
+ cmCPackIFWResourcesParser parser(this);
+ for (size_t i = 0; i < Resources.size(); i++) {
+ if (parser.ParseResource(i)) {
+ std::string name = cmSystemTools::GetFilenameName(Resources[i]);
+ std::string path = Directory + "/resources/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(),
+ path.data());
+ resources.push_back(name);
+ } else {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \""
+ << Resources[i] << "\". Resource will be skipped."
+ << std::endl);
+ }
+ }
+ Resources = resources;
+ }
+
xout.EndElement();
xout.EndDocument();
}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index f72d379..c9265ec 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -94,6 +94,9 @@ public:
/// Filename for a custom installer control script
std::string ControlScript;
+ /// List of resources to include in the installer binary
+ std::vector<std::string> Resources;
+
public:
// Internal implementation
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index d6b58f2..e6aba89 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -163,6 +164,14 @@ int cmCPackGenerator::PrepareNames()
<< std::endl);
return 0;
}
+ const char* algoSignature = this->GetOption("CPACK_PACKAGE_CHECKSUM");
+ if (algoSignature) {
+ if (cmCryptoHash::New(algoSignature).get() == CM_NULLPTR) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot recognize algorithm: "
+ << algoSignature << std::endl);
+ return 0;
+ }
+ }
this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
@@ -980,6 +989,10 @@ int cmCPackGenerator::DoPackage()
return 0;
}
+ /* Prepare checksum algorithm*/
+ const char* algo = this->GetOption("CPACK_PACKAGE_CHECKSUM");
+ CM_AUTO_PTR<cmCryptoHash> crypto = cmCryptoHash::New(algo ? algo : "");
+
/*
* Copy the generated packages to final destination
* - there may be several of them
@@ -992,8 +1005,9 @@ int cmCPackGenerator::DoPackage()
/* now copy package one by one */
for (it = packageFileNames.begin(); it != packageFileNames.end(); ++it) {
std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
+ std::string filename(cmSystemTools::GetFilenameName(*it));
tempPackageFileName = it->c_str();
- tmpPF += "/" + cmSystemTools::GetFilenameName(*it);
+ tmpPF += "/" + filename;
const char* packageFileName = tmpPF.c_str();
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy final package(s): "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)")
@@ -1009,6 +1023,23 @@ int cmCPackGenerator::DoPackage()
}
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- package: "
<< packageFileName << " generated." << std::endl);
+
+ /* Generate checksum file */
+ if (crypto.get() != CM_NULLPTR) {
+ std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
+ hashFile +=
+ "/" + filename.substr(0, filename.rfind(this->GetOutputExtension()));
+ hashFile += "." + cmSystemTools::LowerCase(algo);
+ cmsys::ofstream outF(hashFile.c_str());
+ if (!outF) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create checksum file: "
+ << hashFile << std::endl);
+ return 0;
+ }
+ outF << crypto->HashFile(packageFileName) << " " << filename << "\n";
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- checksum file: "
+ << hashFile << " generated." << std::endl);
+ }
}
return 1;
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 6167e2c..fdf0b0e 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -47,13 +47,6 @@ std::string const& cmCommonTargetGenerator::GetConfigName() const
return this->ConfigName;
}
-std::string cmCommonTargetGenerator::Convert(
- std::string const& source, cmOutputConverter::RelativeRoot relative,
- cmOutputConverter::OutputFormat output)
-{
- return this->LocalGenerator->Convert(source, relative, output);
-}
-
const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
{
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
@@ -204,8 +197,9 @@ std::string cmCommonTargetGenerator::GetManifests()
std::vector<std::string> manifests;
for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
mi != manifest_srcs.end(); ++mi) {
- manifests.push_back(this->Convert(
- (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(),
+ manifests.push_back(this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetWorkingDirectory(), (*mi)->GetFullPath()),
cmOutputConverter::SHELL));
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index b433c18..4c52fe5 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -57,10 +57,6 @@ protected:
// The windows module definition source file (.def), if any.
cmSourceFile const* ModuleDefinitionFile;
- std::string Convert(std::string const& source,
- cmOutputConverter::RelativeRoot relative,
- cmOutputConverter::OutputFormat output);
-
void AppendFortranFormatFlags(std::string& flags,
cmSourceFile const& source);
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index fbbf42f..3296ffc 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -239,19 +239,18 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// written by the original local generator for this directory
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
- std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
- obj, cmOutputConverter::HOME_OUTPUT);
- std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
- obj_i, cmOutputConverter::MAKERULE);
+ std::string binDir = this->LocalGenerator->GetBinaryDirectory();
+ std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
+ std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
internalDepends << obj_i << std::endl;
for (std::set<std::string>::const_iterator i = dependencies.begin();
i != dependencies.end(); ++i) {
- makeDepends << obj_m << ": "
- << this->LocalGenerator->Convert(
- *i, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
- << std::endl;
+ makeDepends
+ << obj_m << ": "
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
+ << std::endl;
internalDepends << " " << *i << std::endl;
}
makeDepends << std::endl;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index eb4c1ec..ba0617f 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -189,6 +189,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
cmGeneratedFileStream fcStream(fcName.c_str());
fcStream << "# Remove fortran modules provided by this target.\n";
fcStream << "FILE(REMOVE";
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::set<std::string>::const_iterator i = provides.begin();
i != provides.end(); ++i) {
std::string mod_upper = mod_dir;
@@ -205,16 +207,16 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
stamp += ".mod.stamp";
fcStream << "\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- mod_lower, cmOutputConverter::START_OUTPUT)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ mod_lower)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- mod_upper, cmOutputConverter::START_OUTPUT)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ mod_upper)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- stamp, cmOutputConverter::START_OUTPUT)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ stamp)
<< "\"\n";
}
fcStream << " )\n";
@@ -329,19 +331,18 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
const char* src = info.Source.c_str();
// Write the include dependencies to the output stream.
- std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
- obj, cmOutputConverter::HOME_OUTPUT);
- std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
- obj_i, cmOutputConverter::MAKERULE);
+ std::string binDir = this->LocalGenerator->GetBinaryDirectory();
+ std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
+ std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for (std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i) {
- makeDepends << obj_m << ": "
- << this->LocalGenerator->Convert(
- *i, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
- << std::endl;
+ makeDepends
+ << obj_m << ": "
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
+ << std::endl;
internalDepends << " " << *i << std::endl;
}
makeDepends << std::endl;
@@ -366,8 +367,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += "/";
proxy += *i;
proxy += ".mod.proxy";
- proxy = this->LocalGenerator->Convert(
- proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+ proxy = cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
// since we require some things add them to our list of requirements
makeDepends << obj_m << ".requires: " << proxy << std::endl;
@@ -382,17 +383,17 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
}
if (!required->second.empty()) {
// This module is known. Depend on its timestamp file.
- std::string stampFile = this->LocalGenerator->Convert(
- required->second, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE);
+ std::string stampFile = cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, required->second)
+ .c_str());
makeDepends << obj_m << ": " << stampFile << "\n";
} else {
// This module is not known to CMake. Try to locate it where
// the compiler will and depend on that.
std::string module;
if (this->FindModule(*i, module)) {
- module = this->LocalGenerator->Convert(
- module, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+ module = cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str());
makeDepends << obj_m << ": " << module << "\n";
}
}
@@ -405,8 +406,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += "/";
proxy += *i;
proxy += ".mod.proxy";
- proxy = this->LocalGenerator->Convert(
- proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+ proxy = cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
}
@@ -427,14 +428,16 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string modFile = mod_dir;
modFile += "/";
modFile += *i;
- modFile = this->LocalGenerator->Convert(
- modFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL);
+ modFile = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(binDir, modFile),
+ cmOutputConverter::SHELL);
std::string stampFile = stamp_dir;
stampFile += "/";
stampFile += m;
stampFile += ".mod.stamp";
- stampFile = this->LocalGenerator->Convert(
- stampFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL);
+ stampFile = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(binDir, stampFile),
+ cmOutputConverter::SHELL);
makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
<< " " << stampFile;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
@@ -453,8 +456,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
// the target finishes building.
std::string driver = this->TargetDirectory;
driver += "/build";
- driver = this->LocalGenerator->Convert(
- driver, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+ driver = cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str());
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 96080a9..41d2f7a 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -48,8 +48,8 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
os << "LOCAL_MODULE := ";
os << targetName << "\n";
os << "LOCAL_SRC_FILES := ";
- std::string path = target->GetLocalGenerator()->ConvertToOutputFormat(
- target->GetFullPath(), cmOutputConverter::MAKERULE);
+ std::string path =
+ cmSystemTools::ConvertToOutputPath(target->GetFullPath().c_str());
os << path << "\n";
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 5a98e34..61f2851 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
std::string subdir = (*it)->ConvertToRelativePath(
- (*it)->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
+ this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory());
if (subdir == ".") {
subdir = "";
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ed73450..4772474 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2579,7 +2579,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Shorten the output name (in expected use case).
cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot());
std::string fname = converter.ConvertToRelativePath(
- outputs[0], cmOutputConverter::HOME_OUTPUT);
+ this->GetMakefiles()[0]->GetState()->GetBinaryDirectory(), outputs[0]);
// Associate the hash with this output.
this->RuleHashes[fname] = hash;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 30a05a0..bd65366 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -760,8 +760,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
- std::string convPath =
- ng->ConvertToRelativePath(path, cmOutputConverter::HOME_OUTPUT);
+ std::string convPath = ng->ConvertToRelativePath(
+ this->LocalGenerators[0]->GetState()->GetBinaryDirectory(), path);
convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
std::replace(convPath.begin(), convPath.end(), '/', '\\');
@@ -774,8 +774,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
- std::string convPath =
- ng->ConvertToRelativePath(path + "/all", cmOutputConverter::HOME);
+ std::string convPath = ng->ConvertToRelativePath(
+ this->LocalGenerators[0]->GetState()->GetSourceDirectory(), path + "/all");
convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
std::replace(convPath.begin(), convPath.end(), '/', '\\');
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index d90ebf0..52ae469 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -319,18 +319,15 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
cache += "/CMakeCache.txt";
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \""
- << lg->ConvertToRelativePath(cache, cmOutputConverter::START_OUTPUT)
- << "\"\n";
+ << " \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
- cmakefileStream << " \""
- << lg->ConvertToRelativePath(
- *i, cmOutputConverter::START_OUTPUT)
+ cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -344,15 +341,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream << "# The corresponding makefile is:\n"
<< "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
- << lg->ConvertToRelativePath(makefileName,
- cmOutputConverter::START_OUTPUT)
+ << lg->ConvertToRelativePath(currentBinDir, makefileName)
<< "\"\n"
- << " \""
- << lg->ConvertToRelativePath(check,
- cmOutputConverter::START_OUTPUT)
+ << " \"" << lg->ConvertToRelativePath(currentBinDir, check)
<< "\"\n";
cmakefileStream << " )\n\n";
+ const std::string binDir = lg->GetBinaryDirectory();
+
// CMake must rerun if a byproduct is missing.
{
cmakefileStream << "# Byproducts of CMake generate step:\n"
@@ -361,9 +357,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
lg->GetMakefile()->GetOutputFiles();
for (std::vector<std::string>::const_iterator k = outfiles.begin();
k != outfiles.end(); ++k) {
- cmakefileStream << " \""
- << lg->ConvertToRelativePath(
- *k, cmOutputConverter::HOME_OUTPUT)
+ cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, *k)
<< "\"\n";
}
@@ -375,9 +369,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
tmpStr = lg->GetCurrentBinaryDirectory();
tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake";
- cmakefileStream << " \""
- << lg->ConvertToRelativePath(
- tmpStr, cmOutputConverter::HOME_OUTPUT)
+ cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -488,9 +480,10 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
}
// Begin the directory-level rules section.
- std::string dir = lg->GetCurrentBinaryDirectory();
- dir = lg->Convert(dir, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE);
+ std::string dir = cmSystemTools::ConvertToOutputPath(
+ lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
+ lg->GetCurrentBinaryDirectory())
+ .c_str());
lg->WriteDivider(ruleFileStream);
ruleFileStream << "# Directory level rules for directory " << dir << "\n\n";
@@ -538,7 +531,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
tname += "/fast";
}
cmOutputConverter conv(mf->GetStateSnapshot());
- tname = conv.ConvertToRelativePath(tname, cmOutputConverter::HOME_OUTPUT);
+ tname =
+ conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname);
cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname);
if (this->Makefiles.empty()) {
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 0dc4497..7664b02 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -382,6 +382,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
{
VisualStudioFolders.clear();
+ std::string rootBinaryDir = root->GetCurrentBinaryDirectory();
for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
tt != projectTargets.end(); ++tt) {
cmGeneratorTarget const* target = *tt;
@@ -405,8 +406,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (vcprojName) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
- dir = root->ConvertToRelativePath(dir.c_str(),
- cmOutputConverter::START_OUTPUT);
+ dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str());
if (dir == ".") {
dir = ""; // msbuild cannot handle ".\" prefix
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5653820..997f46c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -896,9 +896,6 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
{
this->CurrentLocalGenerator = gen;
this->CurrentMakefile = gen->GetMakefile();
- std::string outdir = cmSystemTools::CollapseFullPath(
- this->CurrentLocalGenerator->GetCurrentBinaryDirectory());
- cmSystemTools::SplitPath(outdir, this->CurrentOutputDirectoryComponents);
// Select the current set of configuration types.
this->CurrentConfigurationTypes.clear();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 303dfa0..ebdba3e 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -241,7 +241,6 @@ private:
std::string CurrentXCodeHackMakefile;
std::string CurrentProject;
std::set<std::string> TargetDoneSet;
- std::vector<std::string> CurrentOutputDirectoryComponents;
std::vector<std::string> ProjectSourceDirectoryComponents;
std::vector<std::string> ProjectOutputDirectoryComponents;
std::map<std::string, cmXCodeObject*> GroupMap;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 14bb81e..7ab7de1 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -404,8 +404,8 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const
cmOutputConverter converter(this->Bottom);
cmListFileContext lfc = *this->Cur;
if (!this->Bottom.GetState()->GetIsInTryCompile()) {
- lfc.FilePath =
- converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath = converter.ConvertToRelativePath(
+ this->Bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
}
out << (lfc.Line ? " at " : " in ") << lfc;
}
@@ -430,8 +430,8 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
}
cmListFileContext lfc = *i;
if (!this->Bottom.GetState()->GetIsInTryCompile()) {
- lfc.FilePath =
- converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath = converter.ConvertToRelativePath(
+ this->Bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
}
out << " " << lfc << "\n";
}
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 0e79293..97323c9 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -18,8 +18,9 @@
class cmGlobalGenerator;
-cmLocalCommonGenerator::cmLocalCommonGenerator(
- cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd)
+cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
+ cmMakefile* mf,
+ std::string const& wd)
: cmLocalGenerator(gg, mf)
, WorkingDirectory(wd)
{
@@ -55,8 +56,9 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
// Add a module output directory flag if necessary.
std::string mod_dir = target->GetFortranModuleDirectory();
if (!mod_dir.empty()) {
- mod_dir =
- this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
+ mod_dir = this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->WorkingDirectory, mod_dir),
+ cmOutputConverter::SHELL);
} else {
mod_dir =
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 9012afd..9454739 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -30,21 +30,18 @@ class cmLocalCommonGenerator : public cmLocalGenerator
{
public:
cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf,
- cmOutputConverter::RelativeRoot wd);
+ std::string const& wd);
~cmLocalCommonGenerator() CM_OVERRIDE;
std::string const& GetConfigName() { return this->ConfigName; }
- cmOutputConverter::RelativeRoot GetWorkingDirectory() const
- {
- return this->WorkingDirectory;
- }
+ std::string GetWorkingDirectory() const { return this->WorkingDirectory; }
std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
std::string const& config) CM_OVERRIDE;
protected:
- cmOutputConverter::RelativeRoot WorkingDirectory;
+ std::string WorkingDirectory;
void SetConfigName();
std::string ConfigName;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a76bed3..9b12354 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -177,10 +177,11 @@ void cmLocalGenerator::GenerateTestFiles()
}
typedef std::vector<cmState::Snapshot> vec_t;
vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren();
+ std::string parentBinDir = this->GetCurrentBinaryDirectory();
for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) {
// TODO: Use add_subdirectory instead?
std::string outP = i->GetDirectory().GetCurrentBinary();
- outP = this->ConvertToRelativePath(outP, START_OUTPUT);
+ outP = this->ConvertToRelativePath(parentBinDir, outP);
outP = cmOutputConverter::EscapeForCMake(outP);
fout << "subdirs(" << outP << ")" << std::endl;
}
@@ -1408,7 +1409,9 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
#endif
// Normal behavior.
- return this->Convert(lib, START_OUTPUT, format);
+ return this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib),
+ format);
}
/**
@@ -2242,11 +2245,11 @@ std::string cmLocalGenerator::ConstructComment(
std::string comment;
comment = "Generating ";
const char* sep = "";
+ std::string currentBinaryDir = this->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
o != ccg.GetOutputs().end(); ++o) {
comment += sep;
- comment +=
- this->ConvertToRelativePath(*o, cmOutputConverter::START_OUTPUT);
+ comment += this->ConvertToRelativePath(currentBinaryDir, *o);
sep = ", ";
}
return comment;
@@ -2514,14 +2517,15 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
const char* fullPath = source.GetFullPath().c_str();
// Try referencing the source relative to the source tree.
- std::string relFromSource = this->ConvertToRelativePath(fullPath, START);
+ std::string relFromSource =
+ this->ConvertToRelativePath(this->GetCurrentSourceDirectory(), fullPath);
assert(!relFromSource.empty());
bool relSource = !cmSystemTools::FileIsFullPath(relFromSource.c_str());
bool subSource = relSource && relFromSource[0] != '.';
// Try referencing the source relative to the binary tree.
std::string relFromBinary =
- this->ConvertToRelativePath(fullPath, START_OUTPUT);
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), fullPath);
assert(!relFromBinary.empty());
bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary.c_str());
bool subBinary = relBinary && relFromBinary[0] != '.';
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 6793f84..82e4d2c 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -34,7 +34,7 @@
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT)
+ : cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory())
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
@@ -51,7 +51,7 @@ void cmLocalNinjaGenerator::Generate()
// Compute the path to use when referencing the current output
// directory from the top output directory.
this->HomeRelativeOutputPath = this->ConvertToRelativePath(
- this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
+ this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
}
@@ -145,7 +145,8 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
return this->ConvertToOutputFormat(cmSystemTools::CollapseFullPath(path),
format);
}
- return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format);
+ return this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetBinaryDirectory(), path), format);
}
// Private methods.
@@ -499,8 +500,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
if (ccg.GetWorkingDirectory().empty()) {
- output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ output = this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+ outputs[0]),
+ cmOutputConverter::SHELL);
} else {
output =
this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 611c502..23d1571 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -94,7 +94,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
cmGlobalGenerator* gg, cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT)
+ : cmLocalCommonGenerator(gg, mf, mf->GetCurrentBinaryDirectory())
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
@@ -151,7 +151,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
// Compute the path to use when referencing the current output
// directory from the top output directory.
this->HomeRelativeOutputPath = this->ConvertToRelativePath(
- this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
+ this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
}
@@ -556,8 +556,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
}
// Construct the left hand side of the rule.
- std::string tgt = this->Convert(target, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE);
+ std::string tgt = cmSystemTools::ConvertToOutputPath(
+ this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str());
const char* space = "";
if (tgt.size() == 1) {
@@ -581,11 +581,12 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
} else {
// Split dependencies into multiple rule lines. This allows for
// very long dependency lists even on older make implementations.
+ std::string binDir = this->GetBinaryDirectory();
for (std::vector<std::string>::const_iterator dep = depends.begin();
dep != depends.end(); ++dep) {
replace = *dep;
- replace = this->Convert(replace, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE);
+ replace = cmSystemTools::ConvertToOutputPath(
+ this->ConvertToRelativePath(binDir, replace).c_str());
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -952,6 +953,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// Add each command line to the set of commands.
std::vector<std::string> commands1;
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) {
// Build the command line in a single string.
std::string cmd = ccg.GetCommand(c);
@@ -976,8 +978,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != cmd.npos;
if (workingDir.empty()) {
- cmd =
- this->ConvertToRelativePath(cmd, cmOutputConverter::START_OUTPUT);
+ cmd = this->ConvertToRelativePath(currentBinDir, cmd);
}
bool has_slash = cmd.find('/') != cmd.npos;
if (had_slash && !has_slash) {
@@ -1001,8 +1002,10 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
if (workingDir.empty()) {
- output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ output = this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+ outputs[0]),
+ cmOutputConverter::SHELL);
} else {
output = this->ConvertToOutputFormat(outputs[0],
@@ -1069,7 +1072,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::vector<std::string>& commands, const std::vector<std::string>& files,
cmGeneratorTarget* target, const char* filename)
{
- std::string cleanfile = this->GetCurrentBinaryDirectory();
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
+ std::string cleanfile = currentBinDir;
cleanfile += "/";
cleanfile += this->GetTargetDirectory(target);
cleanfile += "/cmake_clean";
@@ -1087,15 +1091,15 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
fout << "file(REMOVE_RECURSE\n";
for (std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
- std::string fc =
- this->ConvertToRelativePath(*f, cmOutputConverter::START_OUTPUT);
+ std::string fc = this->ConvertToRelativePath(currentBinDir, *f);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
std::string remove = "$(CMAKE_COMMAND) -P ";
- remove += this->Convert(cleanfile, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ remove += this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile),
+ cmOutputConverter::SHELL);
commands.push_back(remove);
// For the main clean rule add per-language cleaning.
@@ -1853,9 +1857,9 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->GetIncludeDirectories(includes, target, l->first, config);
+ std::string binaryDir = this->GetState()->GetBinaryDirectory();
if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
const char* sourceDir = this->GetState()->GetSourceDirectory();
- const char* binaryDir = this->GetState()->GetBinaryDirectory();
std::vector<std::string>::iterator itr =
std::remove_if(includes.begin(), includes.end(),
::NotInProjectDir(sourceDir, binaryDir));
@@ -1863,9 +1867,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
}
for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) {
- cmakefileStream << " \""
- << this->ConvertToRelativePath(
- *i, cmOutputConverter::HOME_OUTPUT)
+ cmakefileStream << " \"" << this->ConvertToRelativePath(binaryDir, *i)
<< "\"\n";
}
cmakefileStream << " )\n";
@@ -1930,7 +1932,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
if (!tgt.empty()) {
// The make target is always relative to the top of the build tree.
std::string tgt2 =
- this->ConvertToRelativePath(tgt, cmOutputConverter::HOME_OUTPUT);
+ this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt);
// The target may have been written with windows paths.
cmSystemTools::ConvertToOutputSlashes(tgt2);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 70fe819..f477a0e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -788,8 +788,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir;
if (target_mod_dir) {
- modDir = this->ConvertToRelativePath(target_mod_dir,
- cmOutputConverter::START_OUTPUT);
+ modDir = this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+ target_mod_dir);
} else {
modDir = ".";
}
@@ -1298,10 +1298,11 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
std::ostream& fout, ItemVector const& libs)
{
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
- std::string rel = lg->ConvertToRelativePath(
- l->Value.c_str(), cmOutputConverter::START_OUTPUT);
+ std::string rel =
+ lg->ConvertToRelativePath(currentBinDir, l->Value.c_str());
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -1316,13 +1317,13 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
// VS < 8 does not support per-config source locations so we
// list object library content on the link line instead.
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
std::vector<std::string> objs;
gt->UseObjectLibraries(objs, "");
const char* sep = isep ? isep : "";
for (std::vector<std::string>::const_iterator oi = objs.begin();
oi != objs.end(); ++oi) {
- std::string rel =
- lg->ConvertToRelativePath(oi->c_str(), cmOutputConverter::START_OUTPUT);
+ std::string rel = lg->ConvertToRelativePath(currentBinDir, oi->c_str());
fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
sep = " ";
}
@@ -1332,6 +1333,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
std::ostream& fout, std::vector<std::string> const& dirs)
{
const char* comma = "";
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator d = dirs.begin();
d != dirs.end(); ++d) {
// Remove any trailing slash and skip empty paths.
@@ -1345,8 +1347,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// Switch to a relative path specification if it is shorter.
if (cmSystemTools::FileIsFullPath(dir.c_str())) {
- std::string rel = this->ConvertToRelativePath(
- dir.c_str(), cmOutputConverter::START_OUTPUT);
+ std::string rel =
+ this->ConvertToRelativePath(currentBinDir, dir.c_str());
if (rel.size() < dir.size()) {
dir = rel;
}
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index d344dc5..77ec6f7 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -205,7 +205,9 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
}
if (workingDirectory.empty()) {
- script += this->Convert(cmd.c_str(), START_OUTPUT, SHELL);
+ script += this->ConvertToOutputFormat(
+ this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd),
+ cmOutputConverter::SHELL);
} else {
script += this->ConvertToOutputFormat(cmd.c_str(), SHELL);
}
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 66e1ca2..82bd1a3 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -138,14 +138,20 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
// Convert to the output path to use in constructing commands.
- std::string targetOutPath = this->Convert(
- targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
- std::string targetOutPathReal =
- this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
+ cmOutputConverter::SHELL);
+ std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
+ cmOutputConverter::SHELL);
std::string targetOutPathImport =
- this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ targetFullPathImport),
+ cmOutputConverter::SHELL);
// Get the language to use for linking this executable.
std::string linkLanguage =
@@ -219,25 +225,27 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPath, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- (targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ (targetFullPath + ".manifest").c_str()));
#endif
if (targetNameReal != targetName) {
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathReal, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
}
if (!targetNameImport.empty()) {
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathImport, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ targetFullPathImport));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- implib, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
}
}
@@ -245,7 +253,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathPDB, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
// Add the pre-build and pre-link rules building but not when relinking.
if (!relink) {
@@ -317,14 +325,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+
+ objectDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
+ cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
cmOutputConverter::OutputFormat output = (useWatcomQuote)
? cmOutputConverter::WATCOMQUOTE
: cmOutputConverter::SHELL;
- std::string target = this->Convert(
- targetFullPathReal, cmOutputConverter::START_OUTPUT, output);
+ std::string target = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
+ output);
vars.Target = target.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index c31c469..1d66d52 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -312,17 +312,25 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// arguments.
std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
- std::string targetOutPath = this->Convert(
- targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
- std::string targetOutPathSO =
- this->Convert(targetFullPathSO, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
- std::string targetOutPathReal =
- this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+
+ std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
+ cmOutputConverter::SHELL);
+ std::string targetOutPathSO = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO),
+ cmOutputConverter::SHELL);
+ std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
+ cmOutputConverter::SHELL);
std::string targetOutPathImport =
- this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ targetFullPathImport),
+ cmOutputConverter::SHELL);
this->NumberOfProgressActions++;
if (!this->NoRuleMessages) {
@@ -368,23 +376,24 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Clean files associated with this library.
std::vector<std::string> libCleanFiles;
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPath, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
if (targetNameReal != targetName) {
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathReal, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
}
if (targetNameSO != targetName && targetNameSO != targetNameReal) {
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathSO, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO));
}
if (!targetNameImport.empty()) {
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathImport, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ targetFullPathImport));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- implib, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
}
}
@@ -392,15 +401,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- targetFullPathPDB, cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- (targetFullPath + ".manifest").c_str(),
- cmOutputConverter::START_OUTPUT));
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ (targetFullPath + ".manifest").c_str()));
}
#endif
@@ -535,14 +544,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+
+ objectDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
+ cmOutputConverter::SHELL);
+
vars.ObjectDir = objectDir.c_str();
cmOutputConverter::OutputFormat output = (useWatcomQuote)
? cmOutputConverter::WATCOMQUOTE
: cmOutputConverter::SHELL;
- std::string target = this->Convert(
- targetFullPathReal, cmOutputConverter::START_OUTPUT, output);
+ std::string target = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
+ output);
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 165f96c..014feb9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -162,6 +162,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// files for this target.
std::vector<cmSourceFile const*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands, config);
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::vector<cmSourceFile const*>::const_iterator si =
customCommands.begin();
si != customCommands.end(); ++si) {
@@ -172,8 +174,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
const std::vector<std::string>& outputs = ccg.GetOutputs();
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
- this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- *o, cmOutputConverter::START_OUTPUT));
+ this->CleanFiles.push_back(
+ this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o));
}
}
}
@@ -214,8 +216,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
*this->BuildFileStream
<< "# Include any dependencies generated for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(dependFileNameFull, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator
+ ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+ dependFileNameFull)
+ .c_str())
<< "\n\n";
if (!this->NoRuleMessages) {
@@ -223,9 +228,12 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
*this->BuildFileStream
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(this->ProgressFileNameFull,
- cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator
+ ->ConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->ProgressFileNameFull)
+ .c_str())
<< "\n\n";
}
@@ -255,8 +263,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
*this->BuildFileStream
<< "# Include the compile flags for this target's objects.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(this->FlagFileNameFull, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator
+ ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+ this->FlagFileNameFull)
+ .c_str())
<< "\n\n";
}
@@ -313,9 +324,9 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
output += cmSystemTools::GetFilenameName(input);
this->Generator->CleanFiles.push_back(
this->Generator->LocalGenerator->ConvertToRelativePath(
- output, cmOutputConverter::START_OUTPUT));
+ this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output));
output = this->Generator->LocalGenerator->ConvertToRelativePath(
- output, cmOutputConverter::HOME_OUTPUT);
+ this->Generator->LocalGenerator->GetBinaryDirectory(), output);
// Create a rule to copy the content into the bundle.
std::vector<std::string> depends;
@@ -515,14 +526,17 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
}
- targetOutPathReal =
- this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
+ cmOutputConverter::SHELL);
targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
- targetOutPathCompilePDB =
- this->Convert(targetFullPathCompilePDB, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ targetFullPathCompilePDB),
+ cmOutputConverter::SHELL);
if (this->LocalGenerator->IsMinGWMake() &&
cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) {
@@ -544,12 +558,16 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->ConvertToOutputFormat(obj, cmOutputConverter::SHELL);
vars.Object = shellObj.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ objectDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
+ cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
- objectFileDir = this->Convert(objectFileDir, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ objectFileDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir),
+ cmOutputConverter::SHELL);
vars.ObjectFileDir = objectFileDir.c_str();
vars.Flags = flags.c_str();
@@ -889,12 +907,14 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
// For multiple outputs, make the extra ones depend on the first one.
std::vector<std::string> const output_depends(1, outputs[0]);
+ std::string binDir = this->LocalGenerator->GetBinaryDirectory();
for (std::vector<std::string>::const_iterator o = outputs.begin() + 1;
o != outputs.end(); ++o) {
// Touch the extra output so "make" knows that it was updated,
// but only if the output was acually created.
- std::string const out = this->Convert(*o, cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::SHELL);
+ std::string const out = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(binDir, *o),
+ cmOutputConverter::SHELL);
std::vector<std::string> output_commands;
bool o_symbolic = false;
@@ -1180,11 +1200,12 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " =";
/* clang-format on */
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->LocalGenerator->ConvertToRelativePath(
- *i, cmOutputConverter::START_OUTPUT);
+ object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i);
*this->BuildFileStream << " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition(
"CMAKE_OBJECT_NAME");
@@ -1217,8 +1238,10 @@ public:
void Feed(std::string const& obj)
{
// Construct the name of the next object.
- this->NextObject = this->LocalGenerator->Convert(
- obj, cmOutputConverter::START_OUTPUT, cmOutputConverter::RESPONSE);
+ this->NextObject = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), obj),
+ cmOutputConverter::RESPONSE);
// Roll over to next string if the limit will be exceeded.
if (this->LengthLimit != std::string::npos &&
@@ -1272,7 +1295,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
- buildTargetRuleName, cmOutputConverter::HOME_OUTPUT);
+ this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName);
// Build the list of target outputs to drive.
std::vector<std::string> depends;
@@ -1460,8 +1483,10 @@ void cmMakefileTargetGenerator::CreateLinkScript(
// Create the makefile command to invoke the link script.
std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script ";
- link_command += this->Convert(
- linkScriptName, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
+ link_command += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName),
+ cmOutputConverter::SHELL);
link_command += " --verbose=$(VERBOSE)";
makefile_commands.push_back(link_command);
makefile_depends.push_back(linkScriptName);
@@ -1492,9 +1517,9 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
if (size_t const limit = calculateCommandLineLengthLimit()) {
// Compute the total length of our list of object files with room
// for argument separation and quoting. This does not convert paths
- // relative to START_OUTPUT like the final list will be, so the actual
- // list will likely be much shorter than this. However, in the worst
- // case all objects will remain as absolute paths.
+ // relative to CMAKE_CURRENT_BINARY_DIR like the final list will be, so the
+ // actual list will likely be much shorter than this. However, in the
+ // worst case all objects will remain as absolute paths.
size_t length = 0;
for (std::vector<std::string>::const_iterator i = this->Objects.begin();
i != this->Objects.end(); ++i) {
@@ -1695,13 +1720,17 @@ void cmMakefileTargetGenerator::GenDefFile(
cmd = this->LocalGenerator->ConvertToOutputFormat(
cmd, cmOutputConverter::SHELL);
cmd += " -E __create_def ";
- cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ cmd += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
+ cmOutputConverter::SHELL);
cmd += " ";
std::string objlist_file = name_of_def_file;
objlist_file += ".objs";
- cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ cmd += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
+ cmOutputConverter::SHELL);
real_link_commands.insert(real_link_commands.begin(), cmd);
// create a list of obj files for the -E __create_def to read
cmGeneratedFileStream fout(objlist_file.c_str());
@@ -1719,9 +1748,10 @@ void cmMakefileTargetGenerator::GenDefFile(
// now add the def file link flag
linkFlags += " ";
linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- linkFlags +=
- this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
- cmOutputConverter::SHELL);
+ linkFlags += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
+ cmOutputConverter::SHELL);
linkFlags += " ";
}
}
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index b709545..8bf0a23 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -53,9 +53,12 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
*this->BuildFileStream
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(this->ProgressFileNameFull,
- cmOutputConverter::HOME_OUTPUT,
- cmOutputConverter::MAKERULE)
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator
+ ->ConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->ProgressFileNameFull)
+ .c_str())
<< "\n\n";
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index b2384b0..f87a788 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -642,7 +642,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
}
}
- // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
+ // If we have any PRE_LINK commands, we need to go back to CMAKE_BINARY_DIR
+ // for
// the link commands.
if (!preLinkCmdLines.empty()) {
const std::string homeOutDir = localGen.ConvertToOutputFormat(
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index ae7c583..7f6edf2 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -46,49 +46,12 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
return this->ConvertToOutputFormat(remote, format);
}
-std::string cmOutputConverter::ConvertToRelativePath(
- const std::string& source, RelativeRoot relative) const
-{
- std::string result;
-
- switch (relative) {
- case HOME:
- result = this->ConvertToRelativePath(
- this->GetState()->GetSourceDirectory(), source);
- break;
- case START:
- result = this->ConvertToRelativePath(
- this->StateSnapshot.GetDirectory().GetCurrentSource(), source);
- break;
- case HOME_OUTPUT:
- result = this->ConvertToRelativePath(
- this->GetState()->GetBinaryDirectory(), source);
- break;
- case START_OUTPUT:
- result = this->ConvertToRelativePath(
- this->StateSnapshot.GetDirectory().GetCurrentBinary(), source);
- break;
- }
- return result;
-}
-
-std::string cmOutputConverter::Convert(const std::string& source,
- RelativeRoot relative,
- OutputFormat output) const
-{
- // Convert the path to a relative path.
- std::string result = this->ConvertToRelativePath(source, relative);
- return this->ConvertToOutputFormat(result, output);
-}
-
std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source,
OutputFormat output) const
{
std::string result = source;
// Convert it to an output path.
- if (output == MAKERULE) {
- result = cmSystemTools::ConvertToOutputPath(result.c_str());
- } else if (output == SHELL || output == WATCOMQUOTE) {
+ if (output == SHELL || output == WATCOMQUOTE) {
result = this->ConvertDirectorySeparatorsForShell(source);
result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
} else if (output == RESPONSE) {
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 1efe109..cc24e53 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -24,40 +24,14 @@ class cmOutputConverter
public:
cmOutputConverter(cmState::Snapshot snapshot);
- /**
- * Convert something to something else. This is a centralized conversion
- * routine used by the generators to handle relative paths and the like.
- * The flags determine what is actually done.
- *
- * relative: treat the argument as a directory and convert it to make it
- * relative or full or unchanged. If relative (HOME, START etc) then that
- * specifies what it should be relative to.
- *
- * output: make the result suitable for output to a...
- *
- * optional: should any relative path operation be controlled by the rel
- * path setting
- */
- enum RelativeRoot
- {
- HOME,
- START,
- HOME_OUTPUT,
- START_OUTPUT
- };
enum OutputFormat
{
- MAKERULE,
SHELL,
WATCOMQUOTE,
RESPONSE
};
std::string ConvertToOutputFormat(const std::string& source,
OutputFormat output) const;
- std::string Convert(const std::string& remote, RelativeRoot local,
- OutputFormat output) const;
- std::string ConvertToRelativePath(const std::string& remote,
- RelativeRoot local) const;
std::string ConvertDirectorySeparatorsForShell(
const std::string& source) const;
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 123b6a4..208fac6 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -85,7 +85,8 @@ void read_stdin(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf)
free(buf->base);
}
-cmServer::cmServer()
+cmServer::cmServer(bool supportExperimental)
+ : SupportExperimental(supportExperimental)
{
// Register supported protocols:
this->RegisterProtocol(new cmServerProtocol1_0);
@@ -93,8 +94,9 @@ cmServer::cmServer()
cmServer::~cmServer()
{
- if (!this->Protocol) // Daemon was never fully started!
+ if (!this->Protocol) { // Server was never fully started!
return;
+ }
uv_close(reinterpret_cast<uv_handle_t*>(this->InputStream), NULL);
uv_close(reinterpret_cast<uv_handle_t*>(this->OutputStream), NULL);
@@ -171,6 +173,9 @@ void cmServer::handleData(const std::string& data)
void cmServer::RegisterProtocol(cmServerProtocol* protocol)
{
+ if (protocol->IsExperimental() && !this->SupportExperimental) {
+ return;
+ }
auto version = protocol->ProtocolVersion();
assert(version.first >= 0);
assert(version.second >= 0);
@@ -196,6 +201,9 @@ void cmServer::PrintHello() const
Json::Value tmp = Json::objectValue;
tmp["major"] = version.first;
tmp["minor"] = version.second;
+ if (proto->IsExperimental()) {
+ tmp["experimental"] = true;
+ }
protocolVersions.append(tmp);
}
@@ -245,9 +253,11 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request)
return request.Reply(Json::objectValue);
}
-void cmServer::Serve()
+bool cmServer::Serve()
{
- assert(!this->SupportedProtocols.empty());
+ if (this->SupportedProtocols.empty()) {
+ return false;
+ }
assert(!this->Protocol);
this->Loop = uv_default_loop();
@@ -279,6 +289,7 @@ void cmServer::Serve()
uv_read_start(this->InputStream, alloc_buffer, read_stdin);
uv_run(this->Loop, UV_RUN_DEFAULT);
+ return true;
}
void cmServer::WriteJsonObject(const Json::Value& jsonValue) const
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 0ef1e17..4a9c3f5 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -31,10 +31,10 @@ class cmServerResponse;
class cmServer
{
public:
- cmServer();
+ cmServer(bool supportExperimental);
~cmServer();
- void Serve();
+ bool Serve();
// for callbacks:
void PopOne();
@@ -59,6 +59,8 @@ private:
static cmServerProtocol* FindMatchingProtocol(
const std::vector<cmServerProtocol*>& protocols, int major, int minor);
+ const bool SupportExperimental;
+
cmServerProtocol* Protocol = nullptr;
std::vector<cmServerProtocol*> SupportedProtocols;
std::vector<std::string> Queue;
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index c3a4d8e..d53ac28 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -262,3 +262,8 @@ const cmServerResponse cmServerProtocol1_0::Process(
return request.ReportError("Unknown command!");
}
+
+bool cmServerProtocol1_0::IsExperimental() const
+{
+ return true;
+}
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 33183e9..e95c2f1 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -82,6 +82,7 @@ public:
virtual ~cmServerProtocol() {}
virtual std::pair<int, int> ProtocolVersion() const = 0;
+ virtual bool IsExperimental() const = 0;
virtual const cmServerResponse Process(const cmServerRequest& request) = 0;
bool Activate(const cmServerRequest& request, std::string* errorMessage);
@@ -100,6 +101,7 @@ class cmServerProtocol1_0 : public cmServerProtocol
{
public:
std::pair<int, int> ProtocolVersion() const override;
+ bool IsExperimental() const override;
const cmServerResponse Process(const cmServerRequest& request) override;
private:
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1b6c93e..1dad742 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -596,8 +596,8 @@ void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const
it != this->TLLCommands.end(); ++it) {
if (it->first == sig) {
cmListFileContext lfc = it->second;
- lfc.FilePath =
- converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME);
+ lfc.FilePath = converter.ConvertToRelativePath(
+ this->Makefile->GetState()->GetSourceDirectory(), lfc.FilePath);
s << " * " << lfc << std::endl;
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8ff7366..85084eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2415,10 +2415,12 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
{
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector libs = cli.GetItems();
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string path = this->LocalGenerator->ConvertToRelativePath(
- l->Value.c_str(), cmOutputConverter::START_OUTPUT);
+ currentBinDir, l->Value.c_str());
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index c09ea8b..38f00e6 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -913,15 +913,32 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
} else if (args[1] == "server") {
- if (args.size() > 2) {
+ if (args.size() > 3) {
cmSystemTools::Error("Too many arguments to start server mode");
return 1;
}
+ bool supportExperimental = false;
+ if (args.size() == 3) {
+ if (args[2] == "--experimental") {
+ supportExperimental = true;
+ } else {
+ cmSystemTools::Error("Unknown argument for server mode");
+ return 1;
+ }
+ }
#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE
- cmServer server;
- server.Serve();
- return 0;
+ cmServer server(supportExperimental);
+ if (server.Serve()) {
+ return 0;
+ } else {
+ cmSystemTools::Error(
+ "CMake server could not find any supported protocol. "
+ "Try with \"--experimental\" to enable "
+ "experimental support.");
+ return 1;
+ }
#else
+ static_cast<void>(supportExperimental);
cmSystemTools::Error("CMake was not built with server mode enabled");
return 1;
#endif
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt
index 46f1367..e42e971 100644
--- a/Tests/RunCMake/CPack/CMakeLists.txt
+++ b/Tests/RunCMake/CPack/CMakeLists.txt
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(${RunCMake_TEST} CXX)
-include(${RunCMake_TEST}.cmake)
+include(${RunCMake_TEST_FILE_PREFIX}.cmake)
# include test generator specifics
-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake")
- include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake")
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-specifics.cmake")
+ include("${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-specifics.cmake")
endif()
set(CPACK_GENERATOR "${GENERATOR_TYPE}")
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
index d09fafe..7c2c9c6 100644
--- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -66,10 +66,16 @@ function(run_cpack_source_test TEST_NAME types)
run_cpack_test_common_for_merge_("${TEST_NAME}" "${types}" false true)
endfunction()
-function(run_cpack_test TEST_NAME types build)
+function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX)
if(TEST_TYPE IN_LIST types)
set(RunCMake_TEST_NO_CLEAN TRUE)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
+ set(full_test_name_ "${TEST_NAME}")
+
+ if(SUBTEST_SUFFIX)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest")
+ set(full_test_name_ "${full_test_name_}-${SUBTEST_SUFFIX}-subtest")
+ endif()
# TODO this should be executed only once per ctest run (not per generator)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
@@ -90,12 +96,14 @@ function(run_cpack_test TEST_NAME types build)
endif()
# execute cmake
- set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}")
- run_cmake(${TEST_NAME})
+ set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}"
+ "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}"
+ "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}")
+ run_cmake(${full_test_name_})
# execute optional build step
if(build)
- run_cmake_command(${TEST_NAME}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake_command(${full_test_name_}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}")
endif()
# execute cpack
@@ -106,11 +114,21 @@ function(run_cpack_test TEST_NAME types build)
ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
)
+ foreach(o out err)
+ if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-${SUBTEST_SUFFIX}-std${o}.txt)
+ set(RunCMake-std${o}-file "${TEST_TYPE}/${TEST_NAME}-${SUBTEST_SUFFIX}-std${o}.txt")
+ elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-std${o}.txt)
+ set(RunCMake-std${o}-file "${TEST_TYPE}/${TEST_NAME}-std${o}.txt")
+ endif()
+ endforeach()
+
# verify result
run_cmake_command(
- ${TEST_TYPE}/${TEST_NAME}
+ ${TEST_TYPE}/${full_test_name_}
"${CMAKE_COMMAND}"
- -DRunCMake_TEST=${TEST_NAME}
+ -DRunCMake_TEST=${full_test_name_}
+ -DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}
+ -DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}
-DGENERATOR_TYPE=${TEST_TYPE}
"-Dsrc_dir=${RunCMake_SOURCE_DIR}"
"-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
@@ -119,3 +137,13 @@ function(run_cpack_test TEST_NAME types build)
)
endif()
endfunction()
+
+function(run_cpack_test TEST_NAME types build)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "")
+endfunction()
+
+function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build)
+ foreach(suffix_ IN LISTS SUBTEST_SUFFIXES)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}")
+ endforeach()
+endfunction()
diff --git a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake b/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake
new file mode 100644
index 0000000..5ca288c
--- /dev/null
+++ b/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake
@@ -0,0 +1,4 @@
+install(FILES CMakeLists.txt DESTINATION foo)
+
+set(CPACK_PACKAGE_NAME "package_checksum")
+set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX})
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index a4caa12..60d42ac 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -19,3 +19,4 @@ run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true)
run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true)
run_cpack_test(DEBUGINFO "RPM" true)
run_cpack_test(LONG_FILENAMES "DEB" false)
+run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false)
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake
new file mode 100644
index 0000000..205dcd8
--- /dev/null
+++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake
@@ -0,0 +1,9 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "0")
+
+if (NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid")
+ set(EXPECTED_FILES_COUNT "1")
+ set(EXPECTED_FILE_1 "package_checksum*.tar.gz")
+ set(EXPECTED_FILE_CONTENT_1 "^[^\n]*package_checksum*-[^\n]*/foo/\n[^\n]*package_checksum-[^\n]*/foo/CMakeLists.txt$")
+endif()
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake
new file mode 100644
index 0000000..e9e65d6
--- /dev/null
+++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake
@@ -0,0 +1,14 @@
+if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid")
+ string(TOLOWER ${RunCMake_SUBTEST_SUFFIX} EXTENSION)
+ file(GLOB PACKAGE RELATIVE ${bin_dir} "*.tar.gz")
+ file(GLOB CSUMFILE RELATIVE ${bin_dir} "*.${EXTENSION}")
+ file(STRINGS ${CSUMFILE} CHSUM_VALUE)
+ file(${RunCMake_SUBTEST_SUFFIX} ${PACKAGE} expected_value )
+ set(expected_value "${expected_value} ${PACKAGE}")
+
+ if(NOT expected_value STREQUAL CHSUM_VALUE)
+ message(FATAL_ERROR "Generated checksum is not valid! Expected [${expected_value}] Got [${CHSUM_VALUE}]")
+ endif()
+else()
+ message(${error})
+endif()
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt
new file mode 100644
index 0000000..abf6d8c
--- /dev/null
+++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt
@@ -0,0 +1,2 @@
+^CPack Error: Cannot recognize algorithm: invalid
+CPack Error: Error when generating package: package_checksum$
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index fc929e3..8bc2a58 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -11,7 +11,7 @@ set(output_error_message
"\nCPack output: '${output}'\nCPack error: '${error}';\nCPack result: '${PACKAGING_RESULT}';\nconfig file: '${config_file_content}'")
# check that expected generated files exist and contain expected content
-include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake")
+include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-ExpectedFiles.cmake")
if(NOT EXPECTED_FILES_COUNT EQUAL 0)
foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
@@ -82,8 +82,8 @@ else()
endif()
# handle additional result verifications
-if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake")
- include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake")
+if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-VerifyResult.cmake")
+ include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-VerifyResult.cmake")
else()
# by default only print out output and error so that they can be compared by
# regex
diff --git a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt
index 7877c01..4dcbab9 100644
--- a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt
@@ -1 +1 @@
-^CMake Error: Too many arguments to start server mode$
+^CMake Error: Unknown argument for server mode$
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index 48ebc89..e89b1f0 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -79,7 +79,7 @@ def writePayload(cmakeCommand, obj):
writeRawData(cmakeCommand, json.dumps(obj))
def initProc(cmakeCommand):
- cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server"],
+ cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)