[Cmake-commits] CMake branch, master, updated. v3.12.1-480-gce153ca

Kitware Robot kwrobot at kitware.com
Mon Aug 27 14:05:07 EDT 2018


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  ce153cacc7010344afbe809973e5129d667ce289 (commit)
       via  4a1b18db55935ab0a1a960fcea51247f1c5b4551 (commit)
       via  07556f15674b7720f9bd7c6b63aedec5d53d8597 (commit)
       via  fa2ecf7fceacc135df5c898d70eeafdcc21afb19 (commit)
       via  9903ec167795d35129c5656b89a56683e4c0fd60 (commit)
       via  fbbc6e2eef37bd3630b6c3a7571533f81070725d (commit)
       via  e558ada9774e0b47214d6cf395a7a926a8583ad6 (commit)
       via  974de0e19932d27576a5c7661905f75b2b8daaa9 (commit)
       via  e4ba1f5a94e25feb0b220637a34eea2e63000c54 (commit)
       via  180c2f8de8b1cc19e7dafeaf571d8fa2b203d78f (commit)
      from  92de93b97486ae93fd73829c8d69e6401858acd3 (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=ce153cacc7010344afbe809973e5129d667ce289
commit ce153cacc7010344afbe809973e5129d667ce289
Merge: 4a1b18d 974de0e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 27 18:04:14 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 27 14:04:22 2018 -0400

    Merge topic 'static-lib-options'
    
    974de0e199 static library: add property STATIC_LIBRARY_OPTIONS
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2290


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a1b18db55935ab0a1a960fcea51247f1c5b4551
commit 4a1b18db55935ab0a1a960fcea51247f1c5b4551
Merge: 07556f1 fbbc6e2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 27 18:02:46 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 27 14:02:51 2018 -0400

    Merge topic 'FindZLIB-ProgramFiles'
    
    fbbc6e2eef FindZLIB: Fix path detection via ProgramFiles env variables
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: RElesgoe <relesgoe at gmail.com>
    Merge-request: !2287


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07556f15674b7720f9bd7c6b63aedec5d53d8597
commit 07556f15674b7720f9bd7c6b63aedec5d53d8597
Merge: fa2ecf7 e558ada
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 27 18:01:51 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 27 14:01:57 2018 -0400

    Merge topic 'doc-include_directories-alternative'
    
    e558ada977 Help: Document alternative to include_directories
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2304


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa2ecf7fceacc135df5c898d70eeafdcc21afb19
commit fa2ecf7fceacc135df5c898d70eeafdcc21afb19
Merge: 9903ec1 e4ba1f5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 27 18:00:54 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 27 14:01:01 2018 -0400

    Merge topic 'ProjectReference'
    
    e4ba1f5a94 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2285


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9903ec167795d35129c5656b89a56683e4c0fd60
commit 9903ec167795d35129c5656b89a56683e4c0fd60
Merge: 92de93b 180c2f8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 27 17:56:58 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 27 13:57:05 2018 -0400

    Merge topic 'ninja-generator-do-not-add-alias-matching-custom-command-output'
    
    180c2f8de8 Ninja: Fix dupbuild error skipping alias with conflicting custom command
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Isaiah <isaiah.norton at gmail.com>
    Merge-request: !2276


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fbbc6e2eef37bd3630b6c3a7571533f81070725d
commit fbbc6e2eef37bd3630b6c3a7571533f81070725d
Author:     Andreas Schneider <asn at cryptomilk.org>
AuthorDate: Mon Aug 13 21:53:17 2018 +0200
Commit:     Andreas Schneider <asn at cryptomilk.org>
CommitDate: Fri Aug 24 07:24:00 2018 +0200

    FindZLIB: Fix path detection via ProgramFiles env variables

diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index a5c04ac..1a4635a 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -58,10 +58,12 @@ if(ZLIB_ROOT)
 endif()
 
 # Normal search.
+set(_ZLIB_x86 "(x86)")
 set(_ZLIB_SEARCH_NORMAL
-  PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
-        "$ENV{PROGRAMFILES}/zlib"
-  )
+    PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
+          "$ENV{ProgramFiles}/zlib"
+          "$ENV{ProgramFiles${_ZLIB_x86}}/zlib")
+unset(_ZLIB_x86)
 list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
 
 set(ZLIB_NAMES z zlib zdll zlib1)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e558ada9774e0b47214d6cf395a7a926a8583ad6
commit e558ada9774e0b47214d6cf395a7a926a8583ad6
Author:     David Demelier <markand at malikania.fr>
AuthorDate: Tue Aug 21 22:47:04 2018 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 23 16:00:02 2018 -0400

    Help: Document alternative to include_directories
    
    Many existing tutorials suggest `include_directories` but that does
    not handle propagation to dependencies and such.  Add a link to its
    documentation suggesting `target_include_directories` instead.

diff --git a/Help/command/include_directories.rst b/Help/command/include_directories.rst
index f694934..e797b5d 100644
--- a/Help/command/include_directories.rst
+++ b/Help/command/include_directories.rst
@@ -33,3 +33,9 @@ Arguments to ``include_directories`` may use "generator expressions" with
 the syntax "$<...>".  See the :manual:`cmake-generator-expressions(7)`
 manual for available expressions.  See the :manual:`cmake-buildsystem(7)`
 manual for more on defining buildsystem properties.
+
+.. note::
+
+  Prefer the :command:`target_include_directories` command to add include
+  directories to individual targets and optionally propagate/export them
+  to dependents.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=974de0e19932d27576a5c7661905f75b2b8daaa9
commit 974de0e19932d27576a5c7661905f75b2b8daaa9
Author:     Marc Chevrier <marc.chevrier at gmail.com>
AuthorDate: Wed Aug 15 15:20:18 2018 +0200
Commit:     Marc Chevrier <marc.chevrier at gmail.com>
CommitDate: Wed Aug 15 15:20:18 2018 +0200

    static library: add property STATIC_LIBRARY_OPTIONS
    
    issue: #18251

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index c9a38fc..8ccd7f6 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -301,6 +301,7 @@ Properties on Targets
    /prop_tgt/SOVERSION
    /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG
    /prop_tgt/STATIC_LIBRARY_FLAGS
+   /prop_tgt/STATIC_LIBRARY_OPTIONS
    /prop_tgt/SUFFIX
    /prop_tgt/TYPE
    /prop_tgt/VERSION
diff --git a/Help/prop_tgt/LINK_FLAGS.rst b/Help/prop_tgt/LINK_FLAGS.rst
index 3a344e6..92cd3c0 100644
--- a/Help/prop_tgt/LINK_FLAGS.rst
+++ b/Help/prop_tgt/LINK_FLAGS.rst
@@ -3,11 +3,12 @@ LINK_FLAGS
 
 Additional flags to use when linking this target if it is a shared library,
 module library, or an executable. Static libraries need to use
-:prop_tgt:`STATIC_LIBRARY_FLAGS`.
+:prop_tgt:`STATIC_LIBRARY_OPTIONS` or :prop_tgt:`STATIC_LIBRARY_FLAGS`
+properties.
 
-The LINK_FLAGS property, managed as a string, can be used to add extra flags
-to the link step of a target.  :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the
-configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
+The ``LINK_FLAGS`` property, managed as a string, can be used to add extra
+flags to the link step of a target.  :prop_tgt:`LINK_FLAGS_<CONFIG>` will add
+to the configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
 ``MINSIZEREL``, ``RELWITHDEBINFO``, ...
 
 .. note::
diff --git a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
index c30ecf1..e3918ca 100644
--- a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
+++ b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
@@ -1,7 +1,8 @@
 LINK_FLAGS_<CONFIG>
 -------------------
 
-Per-configuration linker flags for a shared library, module or executable target.
+Per-configuration linker flags for a shared library, module or executable
+target.
 
 This is the configuration-specific version of :prop_tgt:`LINK_FLAGS`.
 
diff --git a/Help/prop_tgt/LINK_OPTIONS.rst b/Help/prop_tgt/LINK_OPTIONS.rst
index c5263a2..bd5e937 100644
--- a/Help/prop_tgt/LINK_OPTIONS.rst
+++ b/Help/prop_tgt/LINK_OPTIONS.rst
@@ -1,7 +1,10 @@
 LINK_OPTIONS
 ------------
 
-List of options to use when linking this target.
+List of options to use for the link step of shared library, module
+and executable targets. Targets that are static libraries need to use
+the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
+
 
 This property holds a :ref:`;-list <CMake Language Lists>` of options
 specified so far for its target.  Use the :command:`target_link_options`
diff --git a/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst b/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
index c91b1ae..66e0e8b 100644
--- a/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
+++ b/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
@@ -2,11 +2,16 @@ STATIC_LIBRARY_FLAGS
 --------------------
 
 Archiver (or MSVC librarian) flags for a static library target.
-Targets that are shared libraries, modules, or executables can use
-the :prop_tgt:`LINK_OPTIONS` or :prop_tgt:`LINK_FLAGS` target property.
+Targets that are shared libraries, modules, or executables need to use
+the :prop_tgt:`LINK_OPTIONS` or :prop_tgt:`LINK_FLAGS` target properties.
 
-The STATIC_LIBRARY_FLAGS property, managed as a string, can be used to add
+The ``STATIC_LIBRARY_FLAGS`` property, managed as a string, can be used to add
 extra flags to the link step of a static library target.
 :prop_tgt:`STATIC_LIBRARY_FLAGS_<CONFIG>` will add to the configuration
 ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``, ``MINSIZEREL``,
 ``RELWITHDEBINFO``, ...
+
+.. note::
+
+  This property has been superseded by :prop_tgt:`STATIC_LIBRARY_OPTIONS`
+  property.
diff --git a/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst b/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
index b867ac4..5b97941 100644
--- a/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
+++ b/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
@@ -1,6 +1,12 @@
 STATIC_LIBRARY_FLAGS_<CONFIG>
 -----------------------------
 
-Per-configuration archiver (or MSVC librarian) flags for a static library target.
+Per-configuration archiver (or MSVC librarian) flags for a static library
+target.
 
 This is the configuration-specific version of :prop_tgt:`STATIC_LIBRARY_FLAGS`.
+
+.. note::
+
+  This property has been superseded by :prop_tgt:`STATIC_LIBRARY_OPTIONS`
+  property.
diff --git a/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
new file mode 100644
index 0000000..6e03185
--- /dev/null
+++ b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
@@ -0,0 +1,20 @@
+STATIC_LIBRARY_OPTIONS
+----------------------
+
+Archiver (or MSVC librarian) flags for a static library target.
+Targets that are shared libraries, modules, or executables need to use
+the :prop_tgt:`LINK_OPTIONS` target property.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+specified so far for its target.  Use :command:`set_target_properties` or
+:command:`set_property` commands to set its content.
+
+Contents of ``STATIC_LIBRARY_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions.  See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
+
+.. note::
+
+  This property must be used in preference to :prop_tgt:`STATIC_LIBRARY_FLAGS`
+  property.
diff --git a/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst b/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst
new file mode 100644
index 0000000..087dc76
--- /dev/null
+++ b/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst
@@ -0,0 +1,4 @@
+STATIC_LIBRARY_OPTIONS
+----------------------
+
+* static library targets gained new :prop_tgt:`STATIC_LIBRARY_OPTIONS` property.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1548374..0b3a945 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3018,6 +3018,47 @@ void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
 }
 
 namespace {
+void processStaticLibraryLinkOptions(
+  cmGeneratorTarget const* tgt,
+  const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
+  std::vector<std::string>& options,
+  std::unordered_set<std::string>& uniqueOptions,
+  cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
+  std::string const& language)
+{
+  processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+                         config, false, "static library link options",
+                         language, OptionsParse::Shell);
+}
+}
+
+void cmGeneratorTarget::GetStaticLibraryLinkOptions(
+  std::vector<std::string>& result, const std::string& config,
+  const std::string& language) const
+{
+  std::vector<cmGeneratorTarget::TargetPropertyEntry*> entries;
+  std::unordered_set<std::string> uniqueOptions;
+
+  cmGeneratorExpressionDAGChecker dagChecker(
+    this->GetName(), "STATIC_LIBRARY_OPTIONS", nullptr, nullptr);
+
+  if (const char* linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
+    std::vector<std::string> options;
+    cmGeneratorExpression ge;
+    cmSystemTools::ExpandListArgument(linkOptions, options);
+    for (const auto& option : options) {
+      std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(option);
+      entries.push_back(
+        new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
+    }
+  }
+  processStaticLibraryLinkOptions(this, entries, result, uniqueOptions,
+                                  &dagChecker, config, language);
+
+  cmDeleteAll(entries);
+}
+
+namespace {
 void processLinkDepends(
   cmGeneratorTarget const* tgt,
   const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6c1f931..1030d91 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -424,6 +424,9 @@ public:
   void GetLinkOptions(std::vector<std::string>& result,
                       const std::string& config,
                       const std::string& language) const;
+  void GetStaticLibraryLinkOptions(std::vector<std::string>& result,
+                                   const std::string& config,
+                                   const std::string& language) const;
 
   void GetLinkDepends(std::vector<std::string>& result,
                       const std::string& config,
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 042ce41..164ffb0 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1844,7 +1844,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
   if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
       gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
     this->CurrentLocalGenerator->GetStaticLibraryFlags(
-      extraLinkOptions, cmSystemTools::UpperCase(configName), gtgt);
+      extraLinkOptions, cmSystemTools::UpperCase(configName), llang, gtgt);
   } else {
     const char* targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
     if (targetLinkFlags) {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5e6ce1a..75b7f23 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -979,6 +979,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
 
 void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
                                              std::string const& config,
+                                             std::string const& linkLanguage,
                                              cmGeneratorTarget* target)
 {
   this->AppendFlags(
@@ -992,6 +993,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
     std::string name = "STATIC_LIBRARY_FLAGS_" + config;
     this->AppendFlags(flags, target->GetProperty(name));
   }
+
+  std::vector<std::string> options;
+  target->GetStaticLibraryLinkOptions(options, config, linkLanguage);
+  // STATIC_LIBRARY_OPTIONS are escaped.
+  this->AppendCompileOptions(flags, options);
 }
 
 void cmLocalGenerator::GetTargetFlags(
@@ -1009,7 +1015,7 @@ void cmLocalGenerator::GetTargetFlags(
 
   switch (target->GetType()) {
     case cmStateEnums::STATIC_LIBRARY:
-      this->GetStaticLibraryFlags(linkFlags, buildType, target);
+      this->GetStaticLibraryFlags(linkFlags, buildType, linkLanguage, target);
       break;
     case cmStateEnums::MODULE_LIBRARY:
       libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 52f0396..a00302c 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -323,6 +323,7 @@ public:
 
   /** Fill out the static linker flags for the given target.  */
   void GetStaticLibraryFlags(std::string& flags, std::string const& config,
+                             std::string const& linkLanguage,
                              cmGeneratorTarget* target);
 
   /** Fill out these strings for the given target.  Libraries to link,
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index b35b116..93e515b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1038,7 +1038,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
         }
       }
       std::string libflags;
-      this->GetStaticLibraryFlags(libflags, configTypeUpper, target);
+      this->GetStaticLibraryFlags(libflags, configTypeUpper,
+                                  target->GetLinkerLanguage(configName),
+                                  target);
       if (!libflags.empty()) {
         fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
       }
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 571e74b..2c565b8 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -148,7 +148,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
 
   std::string extraFlags;
   this->LocalGenerator->GetStaticLibraryFlags(
-    extraFlags, cmSystemTools::UpperCase(this->ConfigName),
+    extraFlags, cmSystemTools::UpperCase(this->ConfigName), linkLanguage,
     this->GeneratorTarget);
   this->WriteLibraryRules(linkRuleVar, extraFlags, false);
 }
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 56d7243..50d93d5 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3055,9 +3055,14 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
       this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) {
     return;
   }
+
+  const std::string& linkLanguage =
+    this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage;
+
   std::string libflags;
   this->LocalGenerator->GetStaticLibraryFlags(
-    libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget);
+    libflags, cmSystemTools::UpperCase(config), linkLanguage,
+    this->GeneratorTarget);
   if (!libflags.empty()) {
     Elem e2(e1, "Lib");
     cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
diff --git a/Tests/RunCMake/LinkStatic/LinkOptionsLib.c b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+  int flags_lib(void)
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
index 0d29492..d3a8afb 100644
--- a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
+++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
@@ -1,3 +1,30 @@
 include(RunCMake)
 
 run_cmake(LINK_SEARCH_STATIC)
+
+
+macro(run_cmake_target test subtest target)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+  unset(RunCMake_TEST_BINARY_DIR)
+  unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+  # Intel compiler does not reject bad flags or objects!
+  set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+  if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+    set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+  endif()
+
+  run_cmake(STATIC_LIBRARY_OPTIONS)
+
+  run_cmake_target(STATIC_LIBRARY_OPTIONS basic StaticLinkOptions)
+  run_cmake_target(STATIC_LIBRARY_OPTIONS genex StaticLinkOptions_genex --config Release)
+  run_cmake_target(STATIC_LIBRARY_OPTIONS shared SharedLinkOptions)
+
+  unset(RunCMake_TEST_OPTIONS)
+  unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
new file mode 100644
index 0000000..858ce06
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG")
+  set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
new file mode 100644
index 0000000..a686de9
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+  set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+  string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
new file mode 100644
index 0000000..8c1e96e
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
@@ -0,0 +1,4 @@
+
+if (actual_stdout MATCHES "BADFLAG")
+  string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
new file mode 100644
index 0000000..587af1d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
@@ -0,0 +1,21 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+  set(pre -)
+endif()
+
+add_library(StaticLinkOptions STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})
+
+# static library with generator expression
+add_library(StaticLinkOptions_genex STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions_genex PROPERTY STATIC_LIBRARY_OPTIONS
+  $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+  "SHELL:" # produces no options
+  )
+
+# shared library do not use property STATIC_LIBRARY_OPTIONS
+add_library(SharedLinkOptions SHARED LinkOptionsLib.c)
+set_property(TARGET SharedLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4ba1f5a94e25feb0b220637a34eea2e63000c54
commit e4ba1f5a94e25feb0b220637a34eea2e63000c54
Author:     Bastien Schatt <bastien.schatt at magestik.fr>
AuthorDate: Sun Aug 12 16:06:56 2018 +0200
Commit:     Bastien Schatt <bastien.schatt at magestik.fr>
CommitDate: Sun Aug 12 16:06:56 2018 +0200

    VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible
    
    Explicitly turn off `ReferenceOutputAssembly` in `ProjectReference`
    elements naming other project files whose types do not produce
    assemblies.  We already do this for `C#` but it makes sense for other
    languages too.
    
    Fixes: #17906

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 41567a3..114f5ec 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3778,31 +3778,29 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
     e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}");
     e2.Element("Name", name);
     this->WriteDotNetReferenceCustomTags(e2, name);
-    if (this->Managed) {
-      // If the dependency target is not managed (compiled with /clr or
-      // C# target) we cannot reference it and have to set
-      // 'ReferenceOutputAssembly' to false.
-      auto referenceNotManaged =
-        dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
-      // Workaround to check for manually set /clr flags.
-      if (referenceNotManaged) {
-        if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
-          std::string flagsStr = flags;
-          if (flagsStr.find("clr") != std::string::npos) {
-            // There is a warning already issued when building the flags.
-            referenceNotManaged = false;
-          }
+
+    // If the dependency target is not managed (compiled with /clr or
+    // C# target) we cannot reference it and have to set
+    // 'ReferenceOutputAssembly' to false.
+    auto referenceNotManaged =
+      dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
+    // Workaround to check for manually set /clr flags.
+    if (referenceNotManaged) {
+      if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
+        std::string flagsStr = flags;
+        if (flagsStr.find("clr") != std::string::npos) {
+          // There is a warning already issued when building the flags.
+          referenceNotManaged = false;
         }
       }
-      // Workaround for static library C# targets
-      if (referenceNotManaged &&
-          dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
-        referenceNotManaged = !dt->HasLanguage("CSharp", "");
-      }
-      if (referenceNotManaged) {
-        e2.Element("ReferenceOutputAssembly", "false");
-        e2.Element("CopyToOutputDirectory", "Never");
-      }
+    }
+    // Workaround for static library C# targets
+    if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
+      referenceNotManaged = !dt->HasLanguage("CSharp", "");
+    }
+    if (referenceNotManaged) {
+      e2.Element("ReferenceOutputAssembly", "false");
+      e2.Element("CopyToOutputDirectory", "Never");
     }
   }
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=180c2f8de8b1cc19e7dafeaf571d8fa2b203d78f
commit 180c2f8de8b1cc19e7dafeaf571d8fa2b203d78f
Author:     Jean-Christophe Fillion-Robin <jchris.fillionr at kitware.com>
AuthorDate: Wed Aug 8 23:40:00 2018 -0400
Commit:     Jean-Christophe Fillion-Robin <jchris.fillionr at kitware.com>
CommitDate: Thu Aug 9 13:32:23 2018 -0400

    Ninja: Fix dupbuild error skipping alias with conflicting custom command
    
    See-also: https://issues.slicer.org/view.php?id=4595
    
    Reported-by: Isaiah Norton <inorton at bwh.harvard.edu>

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6f7e82a..531f79e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1112,6 +1112,12 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
       continue;
     }
 
+    // Don't write alias if there is a already a custom command with
+    // matching output
+    if (this->HasCustomCommandOutput(ta.first)) {
+      continue;
+    }
+
     cmNinjaDeps deps;
     this->AppendTargetOutputs(ta.second, deps);
 
diff --git a/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
new file mode 100644
index 0000000..da6f86a
--- /dev/null
+++ b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.12)
+project(Test LANGUAGES C)
+
+# fake launcher executable
+set(input_launcher_executable ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable "")
+
+# application and executable name
+set(application_target "HelloApp")
+set(application_name "Hello")
+set(executable_name "Hello")
+
+# target built in "<root>/bin"
+add_executable(${application_target} hello.c)
+set_target_properties(${application_target} PROPERTIES
+  OUTPUT_NAME ${executable_name}
+  RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_CURRENT_BINARY_DIR}/bin
+  )
+
+# configured launcher in "<root>"
+set(configured_launcher_executable "${CMAKE_CURRENT_BINARY_DIR}/${application_name}")
+
+# create command to copy the launcher
+add_custom_command(
+  DEPENDS
+    ${input_launcher_executable}
+  OUTPUT
+    ${configured_launcher_executable}
+  COMMAND
+    ${CMAKE_COMMAND} -E copy ${input_launcher_executable} ${configured_launcher_executable}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT
+    "Configuring application launcher: ${application_name}"
+  )
+
+add_custom_target(Configure${application_name}Launcher ALL
+  DEPENDS
+    ${application_target}
+    ${input_launcher_executable}
+    ${configured_launcher_executable}
+  )
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index b6e6cd4..e0ddc9c 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -278,3 +278,10 @@ foreach(ninja_output_path_prefix "sub space" "sub")
   run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}")
   run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}")
 endforeach(ninja_output_path_prefix)
+
+function (run_PreventTargetAliasesDupBuildRule)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build)
+  run_cmake(PreventTargetAliasesDupBuildRule)
+  run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err)
+endfunction ()
+run_PreventTargetAliasesDupBuildRule()

-----------------------------------------------------------------------

Summary of changes:
 Help/command/include_directories.rst               |  6 +++
 Help/manual/cmake-properties.7.rst                 |  1 +
 Help/prop_tgt/LINK_FLAGS.rst                       |  9 ++--
 Help/prop_tgt/LINK_FLAGS_CONFIG.rst                |  3 +-
 Help/prop_tgt/LINK_OPTIONS.rst                     |  5 ++-
 Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst             | 11 +++--
 Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst      |  8 +++-
 Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst           | 20 +++++++++
 Help/release/dev/STATIC_LIBRARY_OPTIONS.rst        |  4 ++
 Modules/FindZLIB.cmake                             |  8 ++--
 Source/cmGeneratorTarget.cxx                       | 41 +++++++++++++++++
 Source/cmGeneratorTarget.h                         |  3 ++
 Source/cmGlobalNinjaGenerator.cxx                  |  6 +++
 Source/cmGlobalXCodeGenerator.cxx                  |  2 +-
 Source/cmLocalGenerator.cxx                        |  8 +++-
 Source/cmLocalGenerator.h                          |  1 +
 Source/cmLocalVisualStudio7Generator.cxx           |  4 +-
 Source/cmMakefileLibraryTargetGenerator.cxx        |  2 +-
 Source/cmVisualStudio10TargetGenerator.cxx         | 51 ++++++++++++----------
 .../LinkOptionsLib.c                               |  0
 Tests/RunCMake/LinkStatic/RunCMakeTest.cmake       | 27 ++++++++++++
 .../STATIC_LIBRARY_OPTIONS-basic-check.cmake       |  4 ++
 .../STATIC_LIBRARY_OPTIONS-basic-result.txt}       |  0
 .../STATIC_LIBRARY_OPTIONS-genex-check.cmake}      |  0
 .../STATIC_LIBRARY_OPTIONS-genex-result.txt}       |  0
 .../STATIC_LIBRARY_OPTIONS-shared-check.cmake      |  4 ++
 .../STATIC_LIBRARY_OPTIONS-shared-result.txt}      |  0
 .../LinkStatic/STATIC_LIBRARY_OPTIONS.cmake        | 21 +++++++++
 .../Ninja/PreventTargetAliasesDupBuildRule.cmake   | 41 +++++++++++++++++
 Tests/RunCMake/Ninja/RunCMakeTest.cmake            |  7 +++
 30 files changed, 256 insertions(+), 41 deletions(-)
 create mode 100644 Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
 create mode 100644 Help/release/dev/STATIC_LIBRARY_OPTIONS.rst
 copy Tests/RunCMake/{target_link_options => LinkStatic}/LinkOptionsLib.c (100%)
 create mode 100644 Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
 copy Tests/RunCMake/{target_link_options/LINK_OPTIONS-shared-result.txt => LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt} (100%)
 copy Tests/RunCMake/{target_link_options/LINK_OPTIONS-shared-check.cmake => LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake} (100%)
 copy Tests/RunCMake/{target_link_options/LINK_OPTIONS-shared-result.txt => LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt} (100%)
 create mode 100644 Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
 copy Tests/RunCMake/{target_link_options/LINK_OPTIONS-shared-result.txt => LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt} (100%)
 create mode 100644 Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
 create mode 100644 Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list