summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/policy/CMP0091.rst4
-rw-r--r--Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst3
-rw-r--r--Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst5
-rw-r--r--Help/variable/CMAKE_Swift_NUM_THREADS.rst8
-rw-r--r--Modules/CMakeSwiftInformation.cmake23
-rw-r--r--Modules/FindPython/Support.cmake21
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake20
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx18
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmLinkLineComputer.cxx34
-rw-r--r--Source/cmLocalGenerator.cxx21
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake3
15 files changed, 122 insertions, 47 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 75ddd5dd30..e3c2f9fc87 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -98,6 +98,7 @@ Variables that Provide Information
/variable/CMAKE_STATIC_LIBRARY_PREFIX
/variable/CMAKE_STATIC_LIBRARY_SUFFIX
/variable/CMAKE_Swift_MODULE_DIRECTORY
+ /variable/CMAKE_Swift_NUM_THREADS
/variable/CMAKE_TOOLCHAIN_FILE
/variable/CMAKE_TWEAK_VERSION
/variable/CMAKE_VERBOSE_MAKEFILE
diff --git a/Help/policy/CMP0091.rst b/Help/policy/CMP0091.rst
index 5b7c4e3d96..1a5878a1fc 100644
--- a/Help/policy/CMP0091.rst
+++ b/Help/policy/CMP0091.rst
@@ -20,7 +20,9 @@ CMake 3.15 and above prefer to leave the MSVC runtime library selection flags
out of the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values and instead
offer a first-class abstraction. The :variable:`CMAKE_MSVC_RUNTIME_LIBRARY`
variable and :prop_tgt:`MSVC_RUNTIME_LIBRARY` target property may be set to
-select the MSVC runtime library.
+select the MSVC runtime library. If they are not set then CMake uses the
+default value ``MultiThreaded$<$<CONFIG:Debug>:Debug>DLL`` which is
+equivalent to the original flags.
This policy provides compatibility with projects that have not been updated
to be aware of the abstraction. The policy setting takes effect as of the
diff --git a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst
index 1e3f5e9ec2..73792def10 100644
--- a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst
+++ b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst
@@ -19,6 +19,9 @@ support per-configuration specification. For example, the code:
selects for the target ``foo`` a multi-threaded statically-linked runtime
library with or without debug information depending on the configuration.
+If this property is not set then CMake uses the default value
+``MultiThreaded$<$<CONFIG:Debug>:Debug>DLL`` to select a MSVC runtime library.
+
.. note::
This property has effect only when policy :policy:`CMP0091` is set to ``NEW``
diff --git a/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst b/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst
index 6ed68c919a..8b54e7ecc9 100644
--- a/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst
+++ b/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst
@@ -20,6 +20,11 @@ support per-configuration specification. For example, the code:
selects for all following targets a multi-threaded statically-linked runtime
library with or without debug information depending on the configuration.
+If this variable is not set then the :prop_tgt:`MSVC_RUNTIME_LIBRARY` target
+property will not be set automatically. If that property is not set then
+CMake uses the default value ``MultiThreaded$<$<CONFIG:Debug>:Debug>DLL``
+to select a MSVC runtime library.
+
.. note::
This variable has effect only when policy :policy:`CMP0091` is set to ``NEW``
diff --git a/Help/variable/CMAKE_Swift_NUM_THREADS.rst b/Help/variable/CMAKE_Swift_NUM_THREADS.rst
new file mode 100644
index 0000000000..cb33678555
--- /dev/null
+++ b/Help/variable/CMAKE_Swift_NUM_THREADS.rst
@@ -0,0 +1,8 @@
+CMAKE_Swift_NUM_THREADS
+-----------------------
+
+Number of threads for parallel compilation for Swift targets.
+
+This variable controls the number of parallel jobs that the swift driver creates
+for building targets. If not specified, it will default to the number of
+logical CPUs on the host.
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 21f18d4000..f6510b922f 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -18,11 +18,16 @@ if(CMAKE_Swift_COMPILER_ID)
endif()
set(CMAKE_INCLUDE_FLAG_Swift "-I ")
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ")
+endif()
set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ")
set(CMAKE_Swift_COMPILER_ARG1 -frontend)
set(CMAKE_Swift_DEFINE_FLAG -D)
set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ")
+set(CMAKE_Swift_LIBRARY_PATH_FLAG "-L ")
+set(CMAKE_Swift_LIBRARY_PATH_TERMINATOR "")
set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
@@ -47,11 +52,15 @@ if(NOT CMAKE_Swift_COMPILE_OBJECT)
set(CMAKE_Swift_COMPILE_OBJECT ":")
endif()
+if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$")
+ cmake_host_system_information(RESULT CMAKE_Swift_NUM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
+endif()
+
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
if(CMAKE_Swift_COMPILER_TARGET)
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> <LINK_LIBRARIES>")
else()
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> <LINK_LIBRARIES>")
endif()
endif()
@@ -61,13 +70,19 @@ endif()
if(NOT CMAKE_Swift_LINK_EXECUTABLE)
if(CMAKE_Swift_COMPILER_TARGET)
- set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
else()
- set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
endif()
endif()
if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
+ if(CMAKE_Swift_COMPILER_TARGET)
+ set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ else()
+ set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ endif()
+
set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
set(CMAKE_Swift_ARCHIVE_FINISH "")
endif()
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 49d8e26cdb..590c7af4e3 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -54,7 +54,7 @@ endmacro()
macro (_PYTHON_FIND_FRAMEWORKS)
set (${_PYTHON_PREFIX}_FRAMEWORKS)
- if (APPLE)
+ if (CMAKE_HOST_APPLE OR APPLE)
set (_pff_frameworks ${CMAKE_FRAMEWORK_PATH}
$ENV{CMAKE_FRAMEWORK_PATH}
~/Library/Frameworks
@@ -483,7 +483,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Apple frameworks handling
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
@@ -500,7 +500,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
endif()
# Windows registry
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
@@ -529,7 +529,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Apple frameworks handling
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
@@ -542,7 +542,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
endif()
# Windows registry
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
@@ -591,7 +591,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Apple frameworks handling
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
@@ -605,7 +605,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Windows registry
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
@@ -641,7 +641,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# For example, typical systems have 'python' for version 2.* and 'python3'
# for version 3.*. So looking for names per dir will find, potentially,
# systematically 'python' (i.e. version 2) even if version 3 is searched.
- if (WIN32)
+ if (CMAKE_HOST_WIN32)
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES python${_${_PYTHON_PREFIX}_VERSION}
python
@@ -656,7 +656,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Apple frameworks handling
- if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
@@ -666,7 +666,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# Windows registry
- if (WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
find_program (${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES}
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
@@ -984,7 +984,6 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
else()
list (REMOVE_ITEM CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
- else()
endif()
# if python interpreter is found, use its location and version to ensure consistency
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 0a98895ce7..e3eeea46ce 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -210,8 +210,8 @@ if(MSVC)
set(_MSVC_IDE_VERSION "")
if(MSVC_VERSION GREATER_EQUAL 2000)
message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
- elseif(MSVC_VERSION_VERSION GREATER_EQUAL 143)
- message(WARNING "MSVC toolset v${MSVC_VERSION_VERSION} not yet supported.")
+ elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 143)
+ message(WARNING "MSVC toolset v${MSVC_TOOLSET_VERSION} not yet supported.")
elseif(MSVC_TOOLSET_VERSION EQUAL 142)
set(MSVC_REDIST_NAME VC142)
set(_MSVC_DLL_VERSION 140)
@@ -251,10 +251,18 @@ if(MSVC)
endif()
if(NOT vs VERSION_LESS 15)
set(_vs_redist_paths "")
- cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) # undocumented query
- if(IS_DIRECTORY "${_vs_dir}")
- file(GLOB _vs_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
- endif()
+ # The toolset and its redistributables may come with any VS version 15 or newer.
+ set(_MSVC_IDE_VERSIONS 16 15)
+ foreach(_vs_ver ${_MSVC_IDE_VERSIONS})
+ set(_vs_glob_redist_paths "")
+ cmake_host_system_information(RESULT _vs_dir QUERY VS_${_vs_ver}_DIR) # undocumented query
+ if(IS_DIRECTORY "${_vs_dir}")
+ file(GLOB _vs_glob_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
+ list(APPEND _vs_redist_paths ${_vs_glob_redist_paths})
+ endif()
+ unset(_vs_glob_redist_paths)
+ endforeach()
+ unset(_MSVC_IDE_VERSIONS)
unset(_vs_dir)
else()
get_filename_component(_vs_dir
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 1fa7988b7f..54c4bae08c 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -266,15 +266,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
}
}
- upload_as += "&MD5=";
-
- if (cmSystemTools::IsOn(this->GetOption("InternalTest"))) {
- upload_as += "bad_md5sum";
- } else {
- upload_as +=
- cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5);
- }
-
// Generate Done.xml right before it is submitted.
// The reason for this is two-fold:
// 1) It must be generated after some other part has been submitted
@@ -286,6 +277,15 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
this->CTest->GenerateDoneFile();
}
+ upload_as += "&MD5=";
+
+ if (cmSystemTools::IsOn(this->GetOption("InternalTest"))) {
+ upload_as += "bad_md5sum";
+ } else {
+ upload_as +=
+ cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5);
+ }
+
if (!cmSystemTools::FileExists(local_file)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot find file: " << local_file << std::endl);
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 89aaad0dce..fe228ff2d4 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -25,6 +25,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
, OldStyle(cc.GetEscapeOldStyle())
, MakeVars(cc.GetEscapeAllowMakeVars())
, GE(new cmGeneratorExpression(cc.GetBacktrace()))
+ , EmulatorsWithArguments(cc.GetCommandLines().size())
{
const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
@@ -107,7 +108,6 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
continue;
}
- this->EmulatorsWithArguments.emplace_back();
cmSystemTools::ExpandListArgument(emulator_property,
this->EmulatorsWithArguments[c]);
}
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 2a8bee6e5a..469faca88e 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -99,14 +99,34 @@ std::string cmLinkLineComputer::ComputeLinkPath(
std::string const& libPathTerminator)
{
std::string linkPath;
- std::vector<std::string> const& libDirs = cli.GetDirectories();
- for (std::string const& libDir : libDirs) {
- std::string libpath = this->ConvertToOutputForExisting(libDir);
- linkPath += " " + libPathFlag;
- linkPath += libpath;
- linkPath += libPathTerminator;
- linkPath += " ";
+
+ if (cli.GetLinkLanguage() == "Swift") {
+ for (const cmComputeLinkInformation::Item& item : cli.GetItems()) {
+ const cmGeneratorTarget* target = item.Target;
+ if (!target) {
+ continue;
+ }
+
+ if (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ target->GetType() == cmStateEnums::SHARED_LIBRARY) {
+ cmStateEnums::ArtifactType type = cmStateEnums::RuntimeBinaryArtifact;
+ if (target->GetType() == cmStateEnums::SHARED_LIBRARY &&
+ target->IsDLLPlatform()) {
+ type = cmStateEnums::ImportLibraryArtifact;
+ }
+
+ linkPath += " " + libPathFlag +
+ item.Target->GetDirectory(cli.GetConfig(), type) +
+ libPathTerminator + " ";
+ }
+ }
}
+
+ for (std::string const& libDir : cli.GetDirectories()) {
+ linkPath += " " + libPathFlag + this->ConvertToOutputForExisting(libDir) +
+ libPathTerminator + " ";
+ }
+
return linkPath;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fe5c8afe10..3abf2ddda6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1444,10 +1444,23 @@ void cmLocalGenerator::OutputLinkLibraries(
std::string linkLanguage = cli.GetLinkLanguage();
- const std::string& libPathFlag =
- this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
- const std::string& libPathTerminator =
- this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
+ std::string libPathFlag;
+ if (const char* value = this->Makefile->GetDefinition(
+ "CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_FLAG")) {
+ libPathFlag = value;
+ } else {
+ libPathFlag =
+ this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
+ }
+
+ std::string libPathTerminator;
+ if (const char* value = this->Makefile->GetDefinition(
+ "CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_TERMINATOR")) {
+ libPathTerminator = value;
+ } else {
+ libPathTerminator =
+ this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
+ }
// Add standard libraries for this language.
std::string standardLibsVar = "CMAKE_";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7ba347177a..8154f3e1ca 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -703,8 +703,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
}
Options targetOptions(this, t, table, gg->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
- std::string asmLocation = configName + "/";
- targetOptions.AddFlag("AssemblerListingLocation", asmLocation);
+ targetOptions.AddFlag("AssemblerListingLocation", "$(IntDir)\\");
targetOptions.Parse(flags);
targetOptions.Parse(defineFlags);
targetOptions.ParseFinish();
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ee5f9b4d0f..8c6ba4edfe 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2643,8 +2643,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("UseFullPaths", "false");
}
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
- std::string asmLocation = configName + "/";
- clOptions.AddFlag("AssemblerListingLocation", asmLocation);
+ clOptions.AddFlag("AssemblerListingLocation", "$(IntDir)");
}
}
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
index c4db11bdeb..9fcc5bcd7b 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
@@ -26,12 +26,14 @@ add_custom_command(OUTPUT output2
# DoesNotUseEmulator: The command will fail if emulator is prepended
add_custom_command(OUTPUT output3
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_unexpected
COMMAND $<TARGET_FILE:generated_exe_emulator_unexpected>
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3
DEPENDS generated_exe_emulator_unexpected)
# DoesNotUseEmulator: The command will fail if emulator is prepended
add_custom_command(OUTPUT outputImp
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_unexpected_imported
COMMAND generated_exe_emulator_unexpected_imported
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp
)
@@ -39,6 +41,7 @@ add_custom_command(OUTPUT outputImp
# UsesEmulator: The command only succeeds if the emulator is prepended
# to the command.
add_custom_command(OUTPUT output4
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_expected
COMMAND generated_exe_emulator_expected
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4
DEPENDS generated_exe_emulator_expected)