This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 842f70c49359bfd9a13e333f2571371f64d163e1 (commit) via a7d2efc15b117e404aeaf952c762a96ba34787a3 (commit) via 36140d864e71ee3d61240da42df2318b01cfbced (commit) via 65f5df7d08f2c96d551f578ec509271888ecb7be (commit) via 9ba901eb3c6579baaf2fec9996e0cbf7b5514fa7 (commit) via 07a80c70020e0e533db8d75d7fe7c4270cc25afb (commit) via 013bee698e8470169d99e90aa86d5d85693c6b12 (commit) via 3eb16de32733c7d3f61d22b16a893135267e7bbc (commit) via b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2 (commit) via d91b5a72cd751b75fbce163fa7a3ea2f05bf484d (commit) via 5efac09beda23c1fb188c660df39b1884f252f64 (commit) via fec441ec17d74b6444fad2a3e32a47dd19f1be5b (commit) via 7456739e2401baa34ccec2989d604ea74ebb2f77 (commit) from 4b68baa776bf8ccc2911057fc79b558515438900 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=842f70c49359bfd9a13e333f2571371f64d163e1 commit 842f70c49359bfd9a13e333f2571371f64d163e1 Merge: a7d2efc fec441e Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jun 4 12:35:05 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jun 4 08:37:55 2019 -0400 Merge topic 'emulator-arguments' fec441ec17 Teach CROSSCOMPILING_EMULATOR to support arguments Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3402 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7d2efc15b117e404aeaf952c762a96ba34787a3 commit a7d2efc15b117e404aeaf952c762a96ba34787a3 Merge: 36140d8 07a80c7 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jun 4 12:34:10 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jun 4 08:37:04 2019 -0400 Merge topic 'remove_directories' 07a80c7002 cmake: Teach -E remove_directory to remove multiple directories 013bee698e Tests: Add RunCMake.CommandLine make_directory test checks 3eb16de327 Tests: Fix RunCMake.CommandLine make_directory test name Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3411 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36140d864e71ee3d61240da42df2318b01cfbced commit 36140d864e71ee3d61240da42df2318b01cfbced Merge: 65f5df7 d91b5a7 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jun 4 12:33:11 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jun 4 08:35:47 2019 -0400 Merge topic 'ninja-nvcc-rsp' d91b5a72cd Ninja: Add support for CUDA nvcc response files 5efac09bed Ninja: Compute linker response file flag earlier Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3399 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65f5df7d08f2c96d551f578ec509271888ecb7be commit 65f5df7d08f2c96d551f578ec509271888ecb7be Merge: 9ba901e b06f4c8 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jun 4 12:33:32 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jun 4 08:34:21 2019 -0400 Merge topic 'executables-are-consoled' b06f4c8a74 Swift: disallow WIN32_EXECUTABLE properties Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3410 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ba901eb3c6579baaf2fec9996e0cbf7b5514fa7 commit 9ba901eb3c6579baaf2fec9996e0cbf7b5514fa7 Merge: 4b68baa 7456739 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jun 4 12:32:47 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jun 4 08:33:14 2019 -0400 Merge topic 'swift-linker-flags' 7456739e24 Swift: avoid `CMAKE_{EXE,SHARED}_LINKER_FLAGS` Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3406 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07a80c70020e0e533db8d75d7fe7c4270cc25afb commit 07a80c70020e0e533db8d75d7fe7c4270cc25afb Author: John Freeman <jfreema...@gmail.com> AuthorDate: Fri May 31 16:35:41 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 14:20:00 2019 -0400 cmake: Teach -E remove_directory to remove multiple directories The `make_directory` command can make multiple directories in a single invocation. Make `remove_directory` mirror that behavior. diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 107c2cb..f1d02eb 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -514,8 +514,8 @@ Available commands are: ``remove`` does not follow symlinks. That means it remove only symlinks and not files it point to. -``remove_directory <dir>`` - Remove a directory and its contents. If a directory does +``remove_directory <dir>...`` + Remove ``<dir>`` directories and their contents. If a directory does not exist it will be silently ignored. ``rename <oldname> <newname>`` diff --git a/Help/release/dev/remove_directories.rst b/Help/release/dev/remove_directories.rst new file mode 100644 index 0000000..1b16df1 --- /dev/null +++ b/Help/release/dev/remove_directories.rst @@ -0,0 +1,5 @@ +remove_directories +------------------ + +* The :manual:`cmake(1)` ``-E remove_directory`` command learned to support + removing multiple directories. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index f4ef45c..a983d30 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -103,7 +103,7 @@ void CMakeCommandUsage(const char* program) << " sha512sum <file>... - create SHA512 checksum of files\n" << " remove [-f] <file>... - remove the file(s), use -f to force " "it\n" - << " remove_directory dir - remove a directory and its contents\n" + << " remove_directory <dir>... - remove directories and their contents\n" << " rename oldname newname - rename a file or directory " "(on one volume)\n" << " server - start cmake in server mode\n" @@ -661,7 +661,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) #endif if (args[1] == "make_directory" && args.size() > 2) { - // If error occurs we want to continue copying next files. + // If an error occurs, we want to continue making directories. bool return_value = false; for (auto const& arg : cmMakeRange(args).advance(2)) { if (!cmSystemTools::MakeDirectory(arg)) { @@ -672,13 +672,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) return return_value; } - if (args[1] == "remove_directory" && args.size() == 3) { - if (cmSystemTools::FileIsDirectory(args[2]) && - !cmSystemTools::RemoveADirectory(args[2])) { - std::cerr << "Error removing directory \"" << args[2] << "\".\n"; - return 1; + if (args[1] == "remove_directory" && args.size() > 2) { + // If an error occurs, we want to continue removing directories. + bool return_value = false; + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (cmSystemTools::FileIsDirectory(arg) && + !cmSystemTools::RemoveADirectory(arg)) { + std::cerr << "Error removing directory \"" << arg << "\".\n"; + return_value = true; + } } - return 0; + return return_value; } // Remove file diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-check.cmake b/Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-check.cmake new file mode 100644 index 0000000..fd6ea11 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-check.cmake @@ -0,0 +1,3 @@ +if(IS_DIRECTORY ${out}/parent/child) + set(RunCMake_TEST_FAILED "child directory was not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-stderr.txt b/Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-three-directories-check.cmake b/Tests/RunCMake/CommandLine/E_remove_directory-three-directories-check.cmake new file mode 100644 index 0000000..2b7202a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-three-directories-check.cmake @@ -0,0 +1,6 @@ +if(IS_DIRECTORY ${out}/d1) + set(RunCMake_TEST_FAILED "directory d1 was not removed") +endif() +if(IS_DIRECTORY ${out}/d2) + set(RunCMake_TEST_FAILED "directory d2 was not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-three-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_remove_directory-three-directories-stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-check.cmake b/Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-check.cmake new file mode 100644 index 0000000..0aa4a52 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${outfile}) + set(RunCMake_TEST_FAILED "removed non-directory ${outfile}") +endif() diff --git a/Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-stderr.txt b/Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 25a6435..6c17a6a 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -332,10 +332,16 @@ file(MAKE_DIRECTORY ${out}) file(WRITE ${outfile} "") run_cmake_command(E_make_directory-three-directories ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2) +run_cmake_command(E_remove_directory-three-directories + ${CMAKE_COMMAND} -E remove_directory ${out}/d1 ${out}/d2 ${out}/d2) run_cmake_command(E_make_directory-directory-with-parent ${CMAKE_COMMAND} -E make_directory ${out}/parent/child) +run_cmake_command(E_remove_directory-directory-with-parent + ${CMAKE_COMMAND} -E remove_directory ${out}/parent) run_cmake_command(E_make_directory-two-directories-and-file ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile}) +run_cmake_command(E_remove_directory-two-directories-and-file + ${CMAKE_COMMAND} -E remove_directory ${out}/d1 ${out}/d2 ${outfile}) unset(out) unset(outfile) diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt index 64a3cd2..8d2519e 100644 --- a/Tests/StagingPrefix/CMakeLists.txt +++ b/Tests/StagingPrefix/CMakeLists.txt @@ -5,11 +5,12 @@ project(StagingPrefix) # Wipe out the install tree add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ConsumerBuild - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ProducerBuild - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/stage - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/prefix - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ignored + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_BINARY_DIR}/ConsumerBuild + ${CMAKE_BINARY_DIR}/ProducerBuild + ${CMAKE_BINARY_DIR}/stage + ${CMAKE_BINARY_DIR}/prefix + ${CMAKE_BINARY_DIR}/ignored ) add_custom_target(CleanupTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/CleanupProject) set_property( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=013bee698e8470169d99e90aa86d5d85693c6b12 commit 013bee698e8470169d99e90aa86d5d85693c6b12 Author: John Freeman <jfreema...@gmail.com> AuthorDate: Fri May 31 16:35:41 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 14:17:11 2019 -0400 Tests: Add RunCMake.CommandLine make_directory test checks diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-check.cmake b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-check.cmake new file mode 100644 index 0000000..ea3d161 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-check.cmake @@ -0,0 +1,3 @@ +if(NOT IS_DIRECTORY ${out}/parent/child) + set(RunCMake_TEST_FAILED "child directory was not created") +endif() diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-check.cmake b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-check.cmake new file mode 100644 index 0000000..c1e8474 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-check.cmake @@ -0,0 +1,6 @@ +if(NOT IS_DIRECTORY ${out}/d1) + set(RunCMake_TEST_FAILED "directory d1 was not created") +endif() +if(NOT IS_DIRECTORY ${out}/d2) + set(RunCMake_TEST_FAILED "directory d2 was not created") +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3eb16de32733c7d3f61d22b16a893135267e7bbc commit 3eb16de32733c7d3f61d22b16a893135267e7bbc Author: John Freeman <jfreema...@gmail.com> AuthorDate: Fri May 31 16:35:41 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 14:16:50 2019 -0400 Tests: Fix RunCMake.CommandLine make_directory test name diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-two-directories-and-file-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt rename to Tests/RunCMake/CommandLine/E_make_directory-two-directories-and-file-result.txt diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-two-directories-and-file-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt rename to Tests/RunCMake/CommandLine/E_make_directory-two-directories-and-file-stderr.txt diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index cee996c..25a6435 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -334,7 +334,7 @@ run_cmake_command(E_make_directory-three-directories ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2) run_cmake_command(E_make_directory-directory-with-parent ${CMAKE_COMMAND} -E make_directory ${out}/parent/child) -run_cmake_command(E_make_directory-three-directories-and-file +run_cmake_command(E_make_directory-two-directories-and-file ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile}) unset(out) unset(outfile) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2 commit b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2 Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Fri May 31 11:30:58 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 14:05:10 2019 -0400 Swift: disallow WIN32_EXECUTABLE properties Currently, the compiler does not synthesize the correct entry point for the application and passing the subsystem flag does not work the same way with the Swift linker language. Add a check to prevent the application of `WIN32_EXECUTABLE` to Swift executables until they can be properly supported. This will prevent the need for a future policy change. Closes: #19325 diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 26886f5..df0f33f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -331,6 +331,37 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const return failed; } +bool cmGlobalGenerator::CheckTargetsForType() const +{ + if (!this->GetLanguageEnabled("Swift")) { + return false; + } + bool failed = false; + for (cmLocalGenerator* generator : this->LocalGenerators) { + for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { + std::vector<std::string> configs; + target->Makefile->GetConfigurations(configs); + if (configs.empty()) { + configs.emplace_back(); + } + + for (std::string const& config : configs) { + if (target->GetLinkerLanguage(config) == "Swift") { + if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) { + this->GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + "WIN32_EXECUTABLE property is not supported on Swift " + "executables", + target->GetBacktrace()); + failed = true; + } + } + } + } + } + return failed; +} + bool cmGlobalGenerator::IsExportedTargetsFile( const std::string& filename) const { @@ -1414,6 +1445,10 @@ bool cmGlobalGenerator::Compute() return false; } + if (this->CheckTargetsForType()) { + return false; + } + for (cmLocalGenerator* localGen : this->LocalGenerators) { localGen->ComputeHomeRelativeOutputPath(); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index dcd8c5f..db96489 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -609,6 +609,7 @@ private: virtual void ForceLinkerLanguages(); bool CheckTargetsForMissingSources() const; + bool CheckTargetsForType() const; void CreateLocalGenerators(); diff --git a/Tests/RunCMake/Swift/E.swift b/Tests/RunCMake/Swift/E.swift new file mode 100644 index 0000000..a415467 --- /dev/null +++ b/Tests/RunCMake/Swift/E.swift @@ -0,0 +1,2 @@ +func f() { +} diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index de99042..4817045 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -6,7 +6,7 @@ if(RunCMake_GENERATOR STREQUAL Xcode) endif() elseif(RunCMake_GENERATOR STREQUAL Ninja) if(CMAKE_Swift_COMPILER) - # Add Ninja-specific Swift tests here. + run_cmake(Win32ExecutableDisallowed) endif() else() run_cmake(NotSupported) diff --git a/Tests/RunCMake/Swift/Win32ExecutableDisallowed-result.txt b/Tests/RunCMake/Swift/Win32ExecutableDisallowed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Swift/Win32ExecutableDisallowed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/Win32ExecutableDisallowed-stderr.txt b/Tests/RunCMake/Swift/Win32ExecutableDisallowed-stderr.txt new file mode 100644 index 0000000..d78101a --- /dev/null +++ b/Tests/RunCMake/Swift/Win32ExecutableDisallowed-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at Win32ExecutableDisallowed.cmake:[0-9]+ \(add_executable\): + WIN32_EXECUTABLE property is not supported on Swift executables +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Swift/Win32ExecutableDisallowed.cmake b/Tests/RunCMake/Swift/Win32ExecutableDisallowed.cmake new file mode 100644 index 0000000..02d5447 --- /dev/null +++ b/Tests/RunCMake/Swift/Win32ExecutableDisallowed.cmake @@ -0,0 +1,4 @@ +enable_language(Swift) +add_executable(E E.swift) +set_target_properties(E PROPERTIES + WIN32_EXECUTABLE TRUE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d91b5a72cd751b75fbce163fa7a3ea2f05bf484d commit d91b5a72cd751b75fbce163fa7a3ea2f05bf484d Author: Francisco Facioni <francisco.faci...@hawkeyeinnovations.com> AuthorDate: Thu May 30 09:35:03 2019 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 11:53:27 2019 -0400 Ninja: Add support for CUDA nvcc response files diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index de9dd99..c0ccb71 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -40,3 +40,8 @@ endif() set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0) set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0) set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0) + +if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0") + set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ") + set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ") +endif() diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 63af69e..7ad8ab3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -182,11 +182,11 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile) if (flag) { responseFlag = flag; - } else { + } else if (this->TargetLinkLanguage != "CUDA") { responseFlag = "@"; } - if (!useResponseFile) { + if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { @@ -300,11 +300,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) if (flag) { responseFlag = flag; - } else { + } else if (this->TargetLinkLanguage != "CUDA") { responseFlag = "@"; } - if (!useResponseFile) { + if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { @@ -713,7 +713,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() bool usedResponseFile = false; globalGen->WriteBuild(this->GetBuildFileStream(), build, commandLineLengthLimit, &usedResponseFile); - this->WriteDeviceLinkRule(false); + this->WriteDeviceLinkRule(usedResponseFile); } void cmNinjaNormalTargetGenerator::WriteLinkStatement() @@ -1047,8 +1047,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() symlinkVars["POST_BUILD"] = postBuildCmdLine; } + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += this->TargetLinkLanguage; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; + + const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); + bool const lang_supports_response = - !(this->TargetLinkLanguage == "RC" || this->TargetLinkLanguage == "CUDA"); + !(this->TargetLinkLanguage == "RC" || + (this->TargetLinkLanguage == "CUDA" && !flag)); int commandLineLengthLimit = -1; if (!lang_supports_response || !this->ForceResponseFile()) { commandLineLengthLimit = diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4c93cf1..2139a45 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -465,12 +465,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) std::string flags = "$FLAGS"; std::string responseFlag; - bool const lang_supports_response = !(lang == "RC" || lang == "CUDA"); + bool const lang_supports_response = lang != "RC"; if (lang_supports_response && this->ForceResponseFile()) { std::string const responseFlagVar = "CMAKE_" + lang + "_RESPONSE_FILE_FLAG"; responseFlag = this->Makefile->GetSafeDefinition(responseFlagVar); - if (responseFlag.empty()) { + if (responseFlag.empty() && lang != "CUDA") { responseFlag = "@"; } } @@ -944,8 +944,16 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::string const objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += language; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_FLAG"; + + const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); + bool const lang_supports_response = - !(language == "RC" || language == "CUDA"); + !(language == "RC" || (language == "CUDA" && !flag)); int const commandLineLengthLimit = ((lang_supports_response && this->ForceResponseFile())) ? -1 : 0; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5efac09beda23c1fb188c660df39b1884f252f64 commit 5efac09beda23c1fb188c660df39b1884f252f64 Author: Francisco Facioni <francisco.faci...@hawkeyeinnovations.com> AuthorDate: Thu May 30 09:35:03 2019 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 11:52:28 2019 -0400 Ninja: Compute linker response file flag earlier diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1399ee2..63af69e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -172,21 +172,24 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile) vars.Language = "CUDA"; std::string responseFlag; + + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += this->TargetLinkLanguage; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; + const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); + + if (flag) { + responseFlag = flag; + } else { + responseFlag = "@"; + } + if (!useResponseFile) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { - std::string cmakeVarLang = "CMAKE_"; - cmakeVarLang += this->TargetLinkLanguage; - - // build response file name - std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; - const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); - if (flag) { - responseFlag = flag; - } else { - responseFlag = "@"; - } rule.RspFile = "$RSP_FILE"; responseFlag += rule.RspFile; @@ -287,21 +290,24 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) } std::string responseFlag; + + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += this->TargetLinkLanguage; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; + const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); + + if (flag) { + responseFlag = flag; + } else { + responseFlag = "@"; + } + if (!useResponseFile) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { - std::string cmakeVarLang = "CMAKE_"; - cmakeVarLang += this->TargetLinkLanguage; - - // build response file name - std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; - const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); - if (flag) { - responseFlag = flag; - } else { - responseFlag = "@"; - } rule.RspFile = "$RSP_FILE"; responseFlag += rule.RspFile; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fec441ec17d74b6444fad2a3e32a47dd19f1be5b commit fec441ec17d74b6444fad2a3e32a47dd19f1be5b Author: Marek Antoniak <kfa...@gmail.com> AuthorDate: Thu May 30 16:11:10 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 10:17:17 2019 -0400 Teach CROSSCOMPILING_EMULATOR to support arguments Fixes: #19321 diff --git a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst index a0811bc..87c5978 100644 --- a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst +++ b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst @@ -6,6 +6,10 @@ This command will be added as a prefix to :command:`add_test`, :command:`add_custom_command`, and :command:`add_custom_target` commands for built target system executables. +If this property contains a :ref:`semicolon-separated list <CMake Language +Lists>`, then the first value is the command and remaining values are its +arguments. + This property is initialized by the value of the :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable if it is set when a target is created. diff --git a/Help/release/dev/emulator-arguments.rst b/Help/release/dev/emulator-arguments.rst new file mode 100644 index 0000000..3edb790 --- /dev/null +++ b/Help/release/dev/emulator-arguments.rst @@ -0,0 +1,6 @@ +emulator-arguments +------------------ + +* The :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable and corresponding + :prop_tgt:`CROSSCOMPILING_EMULATOR` target property learned to support + arguments to the emulator. diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index e7774f2..1d013b7 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -5,6 +5,10 @@ This variable is only used when :variable:`CMAKE_CROSSCOMPILING` is on. It should point to a command on the host system that can run executable built for the target system. +If this variable contains a :ref:`semicolon-separated list <CMake Language +Lists>`, then the first value is the command and remaining values are its +arguments. + The command will be used to run :command:`try_run` generated executables, which avoids manual population of the ``TryRunResults.cmake`` file. diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index e58fc76..89aaad0 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -75,6 +75,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, cmSystemTools::CollapseFullPath(this->WorkingDirectory, build_dir); } } + + this->FillEmulatorsWithArguments(); } cmCustomCommandGenerator::~cmCustomCommandGenerator() @@ -87,19 +89,38 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const return static_cast<unsigned int>(this->CC.GetCommandLines().size()); } -const char* cmCustomCommandGenerator::GetCrossCompilingEmulator( - unsigned int c) const +void cmCustomCommandGenerator::FillEmulatorsWithArguments() { if (!this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")) { - return nullptr; + return; } - std::string const& argv0 = this->CommandLines[c][0]; - cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0); - if (target && target->GetType() == cmStateEnums::EXECUTABLE && - !target->IsImported()) { - return target->GetProperty("CROSSCOMPILING_EMULATOR"); + + for (unsigned int c = 0; c < this->GetNumberOfCommands(); ++c) { + std::string const& argv0 = this->CommandLines[c][0]; + cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0); + if (target && target->GetType() == cmStateEnums::EXECUTABLE && + !target->IsImported()) { + + const char* emulator_property = + target->GetProperty("CROSSCOMPILING_EMULATOR"); + if (!emulator_property) { + continue; + } + + this->EmulatorsWithArguments.emplace_back(); + cmSystemTools::ExpandListArgument(emulator_property, + this->EmulatorsWithArguments[c]); + } } - return nullptr; +} + +std::vector<std::string> cmCustomCommandGenerator::GetCrossCompilingEmulator( + unsigned int c) const +{ + if (c >= this->EmulatorsWithArguments.size()) { + return std::vector<std::string>(); + } + return this->EmulatorsWithArguments[c]; } const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const @@ -129,8 +150,9 @@ bool cmCustomCommandGenerator::HasOnlyEmptyCommandLines() const std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { - if (const char* emulator = this->GetCrossCompilingEmulator(c)) { - return std::string(emulator); + std::vector<std::string> emulator = this->GetCrossCompilingEmulator(c); + if (!emulator.empty()) { + return emulator[0]; } if (const char* location = this->GetArgv0Location(c)) { return std::string(location); @@ -168,9 +190,20 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c, std::string& cmd) const { unsigned int offset = 1; - if (this->GetCrossCompilingEmulator(c) != nullptr) { + std::vector<std::string> emulator = this->GetCrossCompilingEmulator(c); + if (!emulator.empty()) { + for (unsigned j = 1; j < emulator.size(); ++j) { + cmd += " "; + if (this->OldStyle) { + cmd += escapeForShellOldStyle(emulator[j]); + } else { + cmd += this->LG->EscapeForShell(emulator[j], this->MakeVars); + } + } + offset = 0; } + cmCustomCommandLine const& commandLine = this->CommandLines[c]; for (unsigned int j = offset; j < commandLine.size(); ++j) { std::string arg; diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 7fd60c0..766f4b8 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -22,10 +22,12 @@ class cmCustomCommandGenerator bool MakeVars; cmGeneratorExpression* GE; cmCustomCommandLines CommandLines; + std::vector<std::vector<std::string>> EmulatorsWithArguments; std::vector<std::string> Depends; std::string WorkingDirectory; - const char* GetCrossCompilingEmulator(unsigned int c) const; + void FillEmulatorsWithArguments(); + std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const; const char* GetArgv0Location(unsigned int c) const; public: diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 0ccfca8..6e6b9f1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -448,9 +448,11 @@ endif() add_executable(pseudo_emulator pseudo_emulator.c) add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c) +add_executable(pseudo_emulator_custom_command_arg pseudo_emulator_custom_command_arg.c) add_RunCMake_test(CrosscompilingEmulator -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator> - -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>) + -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command> + -DPSEUDO_EMULATOR_CUSTOM_COMMAND_ARG=$<TARGET_FILE:pseudo_emulator_custom_command_arg>) if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(UNIX AND NOT CYGWIN) execute_process(COMMAND ldd --help diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake new file mode 100644 index 0000000..9ca6106 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/output") + message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/output") +endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake new file mode 100644 index 0000000..d9059ca --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake @@ -0,0 +1,14 @@ +set(CMAKE_CROSSCOMPILING 1) + +# Executable: Return error code different from 0 +add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx) + +add_custom_command(OUTPUT output + COMMAND generated_exe_emulator_expected + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output + DEPENDS generated_exe_emulator_expected) + +add_custom_target(ensure_build ALL + SOURCES + ${CMAKE_CURRENT_BINARY_DIR}/output +) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg-build-check.cmake new file mode 100644 index 0000000..13c0db9 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg-build-check.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/AddCustomCommandWithArg-build-check.cmake) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake new file mode 100644 index 0000000..dcd80d5 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake @@ -0,0 +1,9 @@ +set(CMAKE_CROSSCOMPILING 1) + +# Executable: Return error code different from 0 +add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx) + +add_custom_target(generate_output ALL + generated_exe_emulator_expected + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output + DEPENDS generated_exe_emulator_expected) diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 71aaad1..97b7b5a 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -11,13 +11,18 @@ function(CustomCommandGenerator_run_and_build case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(${case}) run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) endfunction() +set(RunCMake_TEST_OPTIONS +"-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND}") CustomCommandGenerator_run_and_build(AddCustomCommand) CustomCommandGenerator_run_and_build(AddCustomTarget) + +set(RunCMake_TEST_OPTIONS +"-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND_ARG}\;custom_argument") +CustomCommandGenerator_run_and_build(AddCustomCommandWithArg) +CustomCommandGenerator_run_and_build(AddCustomTargetWithArg) diff --git a/Tests/RunCMake/pseudo_emulator_custom_command_arg.c b/Tests/RunCMake/pseudo_emulator_custom_command_arg.c new file mode 100644 index 0000000..d00deda --- /dev/null +++ b/Tests/RunCMake/pseudo_emulator_custom_command_arg.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +// Usage: +// +// /path/to/program arg1 [arg2 [...]] +// +// Return EXIT_SUCCESS if 'custom_argument' string was found +// in <arg1> and 'generated_exe_emulator_expected' +// string was found in <arg2> +// Return EXIT_FAILURE if 'custom_argument' string was not +// found in <arg1> or 'generated_exe_emulator_expected' +// string was not found in <arg2>. + +int main(int argc, const char* argv[]) +{ + // Require a slash to make sure it is a path and not a target name. + const char* substring_success = "/generated_exe_emulator_expected"; + const char* substring_custom_argument = "custom_argument"; + + if (argc < 2) { + return EXIT_FAILURE; + } + if (strstr(argv[1], substring_custom_argument) != 0 && + strstr(argv[2], substring_success) != 0) { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7456739e2401baa34ccec2989d604ea74ebb2f77 commit 7456739e2401baa34ccec2989d604ea74ebb2f77 Author: Saleem Abdulrasool <compn...@compnerd.org> AuthorDate: Thu May 30 14:22:20 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jun 3 09:59:39 2019 -0400 Swift: avoid `CMAKE_{EXE,SHARED}_LINKER_FLAGS` Avoid the use of `CMAKE_{EXE,SHARED}_LINKER_FLAGS` when linking with the Swift language. This required hoisting the executable flags of `CMAKE_CREATE_WIN32_EXE`, `CMAKE_CREATE_CONSOLE_EXE`, and `CMAKE_EXE_EXPORTS_*_FLAG` earlier to avoid a second clause which checks the language. This allows for mixed-language Swift projects to properly link on Windows. Fixes #19298 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 87d2232..a6d22ef 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1169,30 +1169,34 @@ void cmLocalGenerator::GetTargetFlags( libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS"; CM_FALLTHROUGH; case cmStateEnums::SHARED_LIBRARY: { - linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable); - linkFlags += " "; - if (!buildType.empty()) { - std::string build = libraryLinkVariable; - build += "_"; - build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build); + if (linkLanguage != "Swift") { + linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable); linkFlags += " "; - } - if (this->Makefile->IsOn("WIN32") && - !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { - std::vector<cmSourceFile*> sources; - target->GetSourceFiles(sources, buildType); - std::string defFlag = - this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - for (cmSourceFile* sf : sources) { - if (sf->GetExtension() == "def") { - linkFlags += defFlag; - linkFlags += this->ConvertToOutputFormat( - cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL); - linkFlags += " "; + if (!buildType.empty()) { + std::string build = libraryLinkVariable; + build += "_"; + build += buildType; + linkFlags += this->Makefile->GetSafeDefinition(build); + linkFlags += " "; + } + if (this->Makefile->IsOn("WIN32") && + !(this->Makefile->IsOn("CYGWIN") || + this->Makefile->IsOn("MINGW"))) { + std::vector<cmSourceFile*> sources; + target->GetSourceFiles(sources, buildType); + std::string defFlag = + this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + for (cmSourceFile* sf : sources) { + if (sf->GetExtension() == "def") { + linkFlags += defFlag; + linkFlags += this->ConvertToOutputFormat( + cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL); + linkFlags += " "; + } } } } + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if (targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1207,6 +1211,7 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; target->GetLinkOptions(opts, config, linkLanguage); // LINK_OPTIONS are escaped. @@ -1217,25 +1222,49 @@ void cmLocalGenerator::GetTargetFlags( } } break; case cmStateEnums::EXECUTABLE: { - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); - linkFlags += " "; - if (!buildType.empty()) { - std::string build = "CMAKE_EXE_LINKER_FLAGS_"; - build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build); + if (linkLanguage != "Swift") { + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); linkFlags += " "; + if (!buildType.empty()) { + std::string build = "CMAKE_EXE_LINKER_FLAGS_"; + build += buildType; + linkFlags += this->Makefile->GetSafeDefinition(build); + linkFlags += " "; + } + if (linkLanguage.empty()) { + cmSystemTools::Error( + "CMake can not determine linker language for target: " + + target->GetName()); + return; + } + + if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) { + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); + linkFlags += " "; + } else { + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); + linkFlags += " "; + } + + if (target->IsExecutableWithExports()) { + std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; + exportFlagVar += linkLanguage; + exportFlagVar += "_FLAG"; + + linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar); + linkFlags += " "; + } } - if (linkLanguage.empty()) { - cmSystemTools::Error( - "CMake can not determine linker language for target: " + - target->GetName()); - return; - } + this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); } + if (cmSystemTools::IsOn( this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") + @@ -1243,23 +1272,6 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += this->Makefile->GetSafeDefinition(sFlagVar); linkFlags += " "; } - if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) { - linkFlags += - this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); - linkFlags += " "; - } else { - linkFlags += - this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); - linkFlags += " "; - } - if (target->IsExecutableWithExports()) { - std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; - exportFlagVar += linkLanguage; - exportFlagVar += "_FLAG"; - - linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar); - linkFlags += " "; - } std::string cmp0065Flags = this->GetLinkLibsCMP0065(linkLanguage, *target); @@ -1282,6 +1294,7 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; target->GetLinkOptions(opts, config, linkLanguage); // LINK_OPTIONS are escaped. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake.1.rst | 4 +- Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst | 4 + Help/release/dev/emulator-arguments.rst | 6 ++ Help/release/dev/remove_directories.rst | 5 + Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst | 4 + Modules/Compiler/NVIDIA-CUDA.cmake | 5 + Source/cmCustomCommandGenerator.cxx | 57 ++++++++--- Source/cmCustomCommandGenerator.h | 4 +- Source/cmGlobalGenerator.cxx | 35 +++++++ Source/cmGlobalGenerator.h | 1 + Source/cmLocalGenerator.cxx | 111 ++++++++++++--------- Source/cmNinjaNormalTargetGenerator.cxx | 67 ++++++++----- Source/cmNinjaTargetGenerator.cxx | 14 ++- Source/cmcmd.cxx | 20 ++-- Tests/RunCMake/CMakeLists.txt | 4 +- ...ake_directory-directory-with-parent-check.cmake | 3 + ...directory-three-directories-and-file-result.txt | 1 - .../E_make_directory-three-directories-check.cmake | 6 ++ ..._directory-two-directories-and-file-result.txt} | 0 ..._directory-two-directories-and-file-stderr.txt} | 0 ...ove_directory-directory-with-parent-check.cmake | 3 + ...ove_directory-directory-with-parent-stderr.txt} | 0 ..._remove_directory-three-directories-check.cmake | 6 ++ ..._remove_directory-three-directories-stderr.txt} | 0 ..._directory-two-directories-and-file-check.cmake | 3 + ..._directory-two-directories-and-file-stderr.txt} | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 8 +- .../AddCustomCommandWithArg-build-check.cmake | 3 + .../AddCustomCommandWithArg.cmake | 14 +++ .../AddCustomTargetWithArg-build-check.cmake | 1 + .../AddCustomTargetWithArg.cmake | 9 ++ .../CrosscompilingEmulator/RunCMakeTest.cmake | 9 +- Tests/RunCMake/Swift/E.swift | 2 + Tests/RunCMake/Swift/RunCMakeTest.cmake | 2 +- .../Win32ExecutableDisallowed-result.txt} | 0 .../Swift/Win32ExecutableDisallowed-stderr.txt | 4 + .../RunCMake/Swift/Win32ExecutableDisallowed.cmake | 4 + .../RunCMake/pseudo_emulator_custom_command_arg.c | 30 ++++++ Tests/StagingPrefix/CMakeLists.txt | 11 +- 39 files changed, 348 insertions(+), 112 deletions(-) create mode 100644 Help/release/dev/emulator-arguments.rst create mode 100644 Help/release/dev/remove_directories.rst create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-check.cmake delete mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-check.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/E_make_directory-two-directories-and-file-result.txt} (100%) rename Tests/RunCMake/CommandLine/{E_make_directory-three-directories-and-file-stderr.txt => E_make_directory-two-directories-and-file-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_remove_directory-directory-with-parent-check.cmake copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/E_remove_directory-directory-with-parent-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_remove_directory-three-directories-check.cmake copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/E_remove_directory-three-directories-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_remove_directory-two-directories-and-file-check.cmake copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/E_remove_directory-two-directories-and-file-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg-build-check.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake create mode 100644 Tests/RunCMake/Swift/E.swift copy Tests/RunCMake/{while/MissingArgument-result.txt => Swift/Win32ExecutableDisallowed-result.txt} (100%) create mode 100644 Tests/RunCMake/Swift/Win32ExecutableDisallowed-stderr.txt create mode 100644 Tests/RunCMake/Swift/Win32ExecutableDisallowed.cmake create mode 100644 Tests/RunCMake/pseudo_emulator_custom_command_arg.c hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits