[Cmake-commits] CMake branch, master, updated. v3.12.2-791-g9fc3024

Kitware Robot kwrobot at kitware.com
Wed Oct 3 08:05:06 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  9fc3024f62304a65c2fb1eaf5303e417530c650d (commit)
       via  a4b9e59568825a440bbbf04504cb556288aed456 (commit)
       via  375b420fdfe4eb34e92b98bb648ba37de3691c2e (commit)
       via  8b21aa0af00a6366c301241bab081f2daae6104c (commit)
       via  3c0bfb596fa53596b16c2f6ed0868f15475b5bf7 (commit)
      from  84457a0dacb7666a92c32920aa9f7bb9953d6940 (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=9fc3024f62304a65c2fb1eaf5303e417530c650d
commit 9fc3024f62304a65c2fb1eaf5303e417530c650d
Merge: a4b9e59 375b420
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 3 12:04:30 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Oct 3 08:04:35 2018 -0400

    Merge topic 'fix-csharp-target-type'
    
    375b420fdf CSharp: Fix regression in VS project type selection
    8b21aa0af0 VS: Fix CSharp flag selection when linking to a static C++ library
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2427


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4b9e59568825a440bbbf04504cb556288aed456
commit a4b9e59568825a440bbbf04504cb556288aed456
Merge: 84457a0 3c0bfb5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 3 12:03:42 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Oct 3 08:03:47 2018 -0400

    Merge topic 'libuv-gnu-hurd'
    
    3c0bfb596f libuv: do not require PATH_MAX to be defined
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2422


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=375b420fdfe4eb34e92b98bb648ba37de3691c2e
commit 375b420fdfe4eb34e92b98bb648ba37de3691c2e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Oct 1 11:26:35 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 2 14:58:11 2018 -0400

    CSharp: Fix regression in VS project type selection
    
    A that target contains only `.cs` sources should be generated as a
    `.csproj` project even if it links to non-CSharp static libraries.
    The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7
    (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget,
    2018-03-19).  The reason is that the `HasLanguage` method added by
    commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as
    wrapper for GetLanguages(), 2018-03-19) enforces its "exclusive" check
    on the combined set of source file languages and the link language.
    To restore the original `TargetIsCSharpOnly` semantics, update
    `HasLanguage` to enforce exclusiveness only on the list of sources.
    
    Fixes: #18239

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b223c5e..8aab1be 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5227,10 +5227,14 @@ bool cmGeneratorTarget::HasLanguage(std::string const& language,
 {
   std::set<std::string> languages;
   this->GetLanguages(languages, config);
+  // The "exclusive" check applies only to source files and not
+  // the linker language which may be affected by dependencies.
+  if (exclusive && languages.size() > 1) {
+    return false;
+  }
   // add linker language (if it is different from compiler languages)
   languages.insert(this->GetLinkerLanguage(config));
-  return (languages.size() == 1 || !exclusive) &&
-    languages.count(language) > 0;
+  return languages.count(language) > 0;
 }
 
 void cmGeneratorTarget::ComputeLinkImplementationLanguages(
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2132b15..2810887 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -366,7 +366,7 @@ public:
 
   // Evaluate if the target uses the given language for compilation
   // and/or linking. If 'exclusive' is true, 'language' is expected
-  // to be the only language used for the target.
+  // to be the only language used in source files for the target.
   bool HasLanguage(std::string const& language, std::string const& config,
                    bool exclusive = true) const;
 
diff --git a/Tests/CSharpLinkToCxx/CMakeLists.txt b/Tests/CSharpLinkToCxx/CMakeLists.txt
index 153c57c..a3067af 100644
--- a/Tests/CSharpLinkToCxx/CMakeLists.txt
+++ b/Tests/CSharpLinkToCxx/CMakeLists.txt
@@ -21,3 +21,9 @@ target_link_libraries(CSharpLinkToCxx CLIApp)
 # because it is unmanaged
 add_library(CppNativeApp SHARED cpp_native.hpp cpp_native.cpp)
 target_link_libraries(CSharpLinkToCxx CppNativeApp)
+
+# Link a static C++ library into the CSharp executable.
+# We do not actually use any symbols but this helps cover
+# link language selection.
+add_library(CppStaticLib STATIC cpp_static.cpp)
+target_link_libraries(CSharpLinkToCxx CppStaticLib)
diff --git a/Tests/CSharpLinkToCxx/cpp_static.cpp b/Tests/CSharpLinkToCxx/cpp_static.cpp
new file mode 100644
index 0000000..9af2b6e
--- /dev/null
+++ b/Tests/CSharpLinkToCxx/cpp_static.cpp
@@ -0,0 +1,3 @@
+void cpp_static()
+{
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b21aa0af00a6366c301241bab081f2daae6104c
commit 8b21aa0af00a6366c301241bab081f2daae6104c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 2 14:50:23 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 2 14:58:11 2018 -0400

    VS: Fix CSharp flag selection when linking to a static C++ library
    
    When a CSharp target links to a static C++ library, CMake will compute
    the link language as C++ instead of CSharp.  That may be incorrect and
    needs further investigation, but it does not affect how VS drives C#
    linking.  However, it does break our flag language selection logic
    and causes C++ flags to be used for CSharp.  In particular, this
    drops the `-platform:x86` flag on 32-bit builds.
    
    Fix this by always selecting the CSharp flags when generating a
    `.csproj` project type.
    
    Issue: #18239

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f472d8a..b8b04ae 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2413,10 +2413,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
   }
 
   // Choose a language whose flags to use for ClCompile.
-  static const char* clLangs[] = { "CXX", "C", "Fortran", "CSharp" };
+  static const char* clLangs[] = { "CXX", "C", "Fortran" };
   std::string langForClCompile;
-  if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) !=
-      cm::cend(clLangs)) {
+  if (this->ProjectType == csproj) {
+    langForClCompile = "CSharp";
+  } else if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) !=
+             cm::cend(clLangs)) {
     langForClCompile = linkLanguage;
   } else {
     std::set<std::string> languages;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c0bfb596fa53596b16c2f6ed0868f15475b5bf7
commit 3c0bfb596fa53596b16c2f6ed0868f15475b5bf7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 28 12:41:12 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Oct 1 08:22:38 2018 -0400

    libuv: do not require PATH_MAX to be defined
    
    Some platforms (e.g. GNU/Hurd) do not define PATH_MAX.  Add a few other
    variants and a fallback constant.  Also use alternatives where possible:
    
    * For readlink(), use lstat() to read the length of the link first.
      If it is not a symlink, report EINVAL before trying to allocate.
      If the size reports as zero, fall back one of the PATH_MAX variants.
    
    * For realpath(), POSIX 2008 allows us to pass a NULL buffer
      to tell it to malloc() internally.
    
    This patch was inspired by downstream patches in Debian packaging
    for issues 897061 and 909011.
    
    Issue: #18337

diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c
index 4545168..a6cc6db 100644
--- a/Utilities/cmlibuv/src/unix/fs.c
+++ b/Utilities/cmlibuv/src/unix/fs.c
@@ -425,19 +425,22 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
   return n;
 }
 
+#if defined(_POSIX_PATH_MAX)
+# define UV__FS_PATH_MAX _POSIX_PATH_MAX
+#elif defined(PATH_MAX)
+# define UV__FS_PATH_MAX PATH_MAX
+#else
+# define UV__FS_PATH_MAX_FALLBACK 8192
+# define UV__FS_PATH_MAX UV__FS_PATH_MAX_FALLBACK
+#endif
 
 static ssize_t uv__fs_pathmax_size(const char* path) {
   ssize_t pathmax;
 
   pathmax = pathconf(path, _PC_PATH_MAX);
 
-  if (pathmax == -1) {
-#if defined(PATH_MAX)
-    return PATH_MAX;
-#else
-#error "PATH_MAX undefined in the current platform"
-#endif
-  }
+  if (pathmax == -1)
+    pathmax = UV__FS_PATH_MAX;
 
   return pathmax;
 }
@@ -446,7 +449,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
   ssize_t len;
   char* buf;
 
+#if defined(UV__FS_PATH_MAX_FALLBACK)
+  /* We may not have a real PATH_MAX.  Read size of link.  */
+  struct stat st;
+  int ret;
+  ret = lstat(req->path, &st);
+  if (ret != 0)
+    return -1;
+  if (!S_ISLNK(st.st_mode)) {
+    errno = EINVAL;
+    return -1;
+  }
+
+  len = st.st_size;
+
+  /* According to readlink(2) lstat can report st_size == 0
+     for some symlinks, such as those in /proc or /sys.  */
+  if (len == 0)
+    len = uv__fs_pathmax_size(req->path);
+#else
   len = uv__fs_pathmax_size(req->path);
+#endif
+
   buf = uv__malloc(len + 1);
 
   if (buf == NULL) {
@@ -473,9 +497,15 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
 }
 
 static ssize_t uv__fs_realpath(uv_fs_t* req) {
-  ssize_t len;
   char* buf;
 
+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L
+  buf = realpath(req->path, NULL);
+  if (buf == NULL)
+    return -1;
+#else
+  ssize_t len;
+
   len = uv__fs_pathmax_size(req->path);
   buf = uv__malloc(len + 1);
 
@@ -488,6 +518,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) {
     uv__free(buf);
     return -1;
   }
+#endif
 
   req->ptr = buf;
 

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

Summary of changes:
 Source/cmGeneratorTarget.cxx               |  8 +++--
 Source/cmGeneratorTarget.h                 |  2 +-
 Source/cmVisualStudio10TargetGenerator.cxx |  8 +++--
 Tests/CSharpLinkToCxx/CMakeLists.txt       |  6 ++++
 Tests/CSharpLinkToCxx/cpp_static.cpp       |  3 ++
 Utilities/cmlibuv/src/unix/fs.c            | 47 +++++++++++++++++++++++++-----
 6 files changed, 60 insertions(+), 14 deletions(-)
 create mode 100644 Tests/CSharpLinkToCxx/cpp_static.cpp


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list