diff options
-rw-r--r-- | Help/command/install.rst | 7 | ||||
-rw-r--r-- | Modules/FindJNI.cmake | 67 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 25 | ||||
-rw-r--r-- | Modules/FindPython.cmake | 6 | ||||
-rw-r--r-- | Modules/FindPython/Support.cmake | 26 | ||||
-rw-r--r-- | Modules/FindPython2.cmake | 6 | ||||
-rw-r--r-- | Modules/FindPython3.cmake | 6 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.h | 8 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 56 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 | ||||
-rw-r--r-- | Source/cmVS141CSharpFlagTable.h | 5 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/kwsys/Terminal.c | 2 | ||||
-rw-r--r-- | Tests/CSharpLinkToCxx/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CSharpLinkToCxx/cpp_static.cpp | 3 | ||||
-rw-r--r-- | Utilities/cmlibuv/src/unix/fs.c | 47 |
18 files changed, 211 insertions, 79 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst index 3a2b4da..08c5718 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -89,6 +89,13 @@ Command signatures that install files may print messages during installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable to control which messages are printed. +Many of the ``install()`` variants implicitly create the directories +containing the installed files. If +:variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` is set, these +directories will be created with the permissions specified. Otherwise, +they will be created according to the uname rules on Unix-like platforms. +Windows platforms are unaffected. + Installing Targets ^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 4913e05..fdddcc7 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -1,29 +1,49 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# FindJNI -# ------- -# -# Find JNI java libraries. -# -# This module finds if Java is installed and determines where the -# include files and libraries are. It also determines what the name of -# the library is. The caller may set variable JAVA_HOME to specify a -# Java installation prefix explicitly. -# -# This module sets the following result variables: -# -# :: -# -# JNI_INCLUDE_DIRS = the include dirs to use -# JNI_LIBRARIES = the libraries to use -# JNI_FOUND = TRUE if JNI headers and libraries were found. -# JAVA_AWT_LIBRARY = the path to the jawt library -# JAVA_JVM_LIBRARY = the path to the jvm library -# JAVA_INCLUDE_PATH = the include path to jni.h -# JAVA_INCLUDE_PATH2 = the include path to jni_md.h -# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h +#[=======================================================================[.rst: +FindJNI +------- + +Find Java Native Interface (JNI) libraries. + +JNI enables Java code running in a Java Virtual Machine (JVM) to call +and be called by native applications and libraries written in other +languages such as C, C++. + +This module finds if Java is installed and determines where the +include files and libraries are. It also determines what the name of +the library is. The caller may set variable ``JAVA_HOME`` to specify a +Java installation prefix explicitly. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module sets the following result variables: + +``JNI_INCLUDE_DIRS`` + the include dirs to use +``JNI_LIBRARIES`` + the libraries to use (JAWT and JVM) +``JNI_FOUND`` + TRUE if JNI headers and libraries were found. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables are also available to set or use: + +``JAVA_AWT_LIBRARY`` + the path to the Java AWT Native Interface (JAWT) library +``JAVA_JVM_LIBRARY`` + the path to the Java Virtual Machine (JVM) library +``JAVA_INCLUDE_PATH`` + the include path to jni.h +``JAVA_INCLUDE_PATH2`` + the include path to jni_md.h and jniport.h +``JAVA_AWT_INCLUDE_PATH`` + the include path to jawt.h +#]=======================================================================] # Expand {libarch} occurrences to java_libarch subdirectory(-ies) and set ${_var} macro(java_append_library_directories _var) @@ -187,6 +207,7 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/lib/jvm/default/jre/lib/{libarch} /usr/lib/jvm/default/lib/{libarch} # Ubuntu specific paths for default JVM + /usr/lib/jvm/java-11-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 18.04 LTS /usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 /usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index cddc5d2..bcdf166 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -8,19 +8,19 @@ # Find Java # # This module finds if Java is installed and determines where the -# include files and libraries are. The caller may set variable JAVA_HOME +# include files and libraries are. The caller may set variable ``JAVA_HOME`` # to specify a Java installation prefix explicitly. # -# See also the :module:`FindJNI` module to find Java development tools. +# See also the :module:`FindJNI` module to find Java Native Interface (JNI). # # Specify one or more of the following components as you call this find module. See example below. # # :: # -# Runtime = User just want to execute some Java byte-compiled +# Runtime = Java Runtime Environment used to execute Java byte-compiled applications # Development = Development tools (java, javac, javah, jar and javadoc), includes Runtime component -# IdlJ = idl compiler for Java -# JarSigner = signer tool for jar +# IdlJ = Interface Description Language (IDL) to Java compiler +# JarSigner = Signer and verifier tool for Java Archive (JAR) files # # # This module sets the following result variables: @@ -44,14 +44,18 @@ # # # The minimum required version of Java can be specified using the -# standard CMake syntax, e.g. find_package(Java 1.5) +# :command:`find_package` syntax, e.g. # -# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to +# .. code-block:: cmake +# +# find_package(Java 1.8) +# +# NOTE: ``${Java_VERSION}`` and ``${Java_VERSION_STRING}`` are not guaranteed to # be identical. For example some java version may return: -# Java_VERSION_STRING = 1.5.0_17 and Java_VERSION = 1.5.0.17 +# ``Java_VERSION_STRING = 1.8.0_17`` and ``Java_VERSION = 1.8.0.17`` # -# another example is the Java OEM, with: Java_VERSION_STRING = 1.6.0-oem -# and Java_VERSION = 1.6.0 +# another example is the Java OEM, with: ``Java_VERSION_STRING = 1.8.0-oem`` +# and ``Java_VERSION = 1.8.0`` # # For these components the following variables are set: # @@ -67,6 +71,7 @@ # :: # # find_package(Java) +# find_package(Java 1.8 REQUIRED) # find_package(Java COMPONENTS Runtime) # find_package(Java COMPONENTS Development) diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 0bf0b4f..8645a0d 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -135,6 +135,12 @@ Hints Value ``ONLY`` is not supported so ``FIRST`` will be used instead. +.. note:: + + If a Python virtual environment is configured, set variable + ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with + value ``LAST`` or ``NEVER`` to select it preferably. + Commands ^^^^^^^^ diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 1834591..a8a73a7 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -355,20 +355,23 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} NAMES_PER_DIR HINTS ${_${_PYTHON_PREFIX}_HINTS} - PATH_SUFFIXES bin + PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) # try using standard paths. - # NAMES_PER_DIR is not defined on purpose to have a chance to find - # expected version. - # For example, typical systems have 'python' for version 2.* and 'python3' - # for version 3.*. So looking for names per dir will find, potentially, - # systematically 'python' (i.e. version 2) even if version 3 is searched. - find_program (${_PYTHON_PREFIX}_EXECUTABLE - NAMES python${_${_PYTHON_PREFIX}_VERSION} - python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} - python - ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}) + if (WIN32) + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION} + python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} + python + ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} + NAMES_PER_DIR) + else() + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION} + python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} + NAMES_PER_DIR) + endif() # Apple frameworks handling if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST") @@ -413,6 +416,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} + NAMES_PER_DIR HINTS ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES} NO_SYSTEM_ENVIRONMENT_PATH diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 2735a25..998e992 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -136,6 +136,12 @@ Hints Value ``ONLY`` is not supported so ``FIRST`` will be used instead. +.. note:: + + If a Python virtual environment is configured, set variable + ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with + value ``LAST`` or ``NEVER`` to select it preferably. + Commands ^^^^^^^^ diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index ed7e1a3..2176f3f 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -136,6 +136,12 @@ Hints Value ``ONLY`` is not supported so ``FIRST`` will be used instead. +.. note:: + + If a Python virtual environment is configured, set variable + ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with + value ``LAST`` or ``NEVER`` to select it preferably. + Commands ^^^^^^^^ diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 408cc7d..129c6fb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 12) -set(CMake_VERSION_PATCH 20181001) +set(CMake_VERSION_PATCH 20181003) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 48a5064..10dceca 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -5,7 +5,6 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include <cmath> #include <set> #include <stddef.h> #include <string> @@ -122,7 +121,12 @@ private: inline int getNumWidth(size_t n) { - return static_cast<int>(std::log10(n)) + 1; + int w = 1; + while (n >= 10) { + n /= 10; + ++w; + } + return w; } #endif diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 54af2f4..1f76703 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1275,6 +1275,33 @@ protected: this->DirPermissions |= mode_world_read; this->DirPermissions |= mode_world_execute; } + + bool GetDefaultDirectoryPermissions(mode_t** mode) + { + // check if default dir creation permissions were set + const char* default_dir_install_permissions = + this->Makefile->GetDefinition( + "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (default_dir_install_permissions && *default_dir_install_permissions) { + std::vector<std::string> items; + cmSystemTools::ExpandListArgument(default_dir_install_permissions, + items); + for (const auto& arg : items) { + if (!this->CheckPermissions(arg, **mode)) { + std::ostringstream e; + e << this->FileCommand->GetError() + << " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS " + "variable."; + this->FileCommand->SetError(e.str()); + return false; + } + } + } else { + *mode = nullptr; + } + + return true; + } }; bool cmFileCopier::Parse(std::vector<std::string> const& args) @@ -1668,8 +1695,15 @@ bool cmFileCopier::InstallDirectory(const char* source, this->ReportCopy(destination, TypeDir, !cmSystemTools::FileIsDirectory(destination)); + // check if default dir creation permissions were set + mode_t default_dir_mode_v = 0; + mode_t* default_dir_mode = &default_dir_mode_v; + if (!this->GetDefaultDirectoryPermissions(&default_dir_mode)) { + return false; + } + // Make sure the destination directory exists. - if (!cmSystemTools::MakeDirectory(destination)) { + if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) { std::ostringstream e; e << this->Name << " cannot make directory \"" << destination << "\": " << cmSystemTools::GetLastSystemError(); @@ -2073,23 +2107,9 @@ bool cmFileInstaller::HandleInstallDestination() // check if default dir creation permissions were set mode_t default_dir_mode_v = 0; - mode_t* default_dir_mode = nullptr; - const char* default_dir_install_permissions = this->Makefile->GetDefinition( - "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); - if (default_dir_install_permissions && *default_dir_install_permissions) { - std::vector<std::string> items; - cmSystemTools::ExpandListArgument(default_dir_install_permissions, items); - for (const auto& arg : items) { - if (!this->CheckPermissions(arg, default_dir_mode_v)) { - std::ostringstream e; - e << this->FileCommand->GetError() - << " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable."; - this->FileCommand->SetError(e.str()); - return false; - } - } - - default_dir_mode = &default_dir_mode_v; + mode_t* default_dir_mode = &default_dir_mode_v; + if (!this->GetDefaultDirectoryPermissions(&default_dir_mode)) { + return false; } if (this->InstallType != cmInstallType_DIRECTORY) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 29c6058..80fb621 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5600,10 +5600,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 bfd95ac..b1daa53 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -374,7 +374,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/Source/cmVS141CSharpFlagTable.h b/Source/cmVS141CSharpFlagTable.h index 5de9bf3..66c61bd 100644 --- a/Source/cmVS141CSharpFlagTable.h +++ b/Source/cmVS141CSharpFlagTable.h @@ -76,7 +76,12 @@ static cmVS7FlagTable cmVS141CSharpFlagTable[] = { { "LangVersion", "langversion:4", "", "4", 0 }, { "LangVersion", "langversion:5", "", "5", 0 }, { "LangVersion", "langversion:6", "", "6", 0 }, + { "LangVersion", "langversion:7.0", "", "7.0", 0 }, + { "LangVersion", "langversion:7.1", "", "7.1", 0 }, + { "LangVersion", "langversion:7.2", "", "7.2", 0 }, + { "LangVersion", "langversion:7.3", "", "7.3", 0 }, { "LangVersion", "langversion:default", "", "default", 0 }, + { "LangVersion", "langversion:latest", "", "latest", 0 }, { "DelaySign", "delaysign", "", "true", 0 }, { "DelaySign", "delaysign-", "", "false", 0 }, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c79b071..16eca96 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2452,10 +2452,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; diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index 1bcfd0c..4dd2461 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -103,6 +103,8 @@ static int kwsysTerminalStreamIsNotInteractive(FILE* stream) /* List of terminal names known to support VT100 color escape sequences. */ static const char* kwsysTerminalVT100Names[] = { "Eterm", + "alacritty", + "alacritty-direct", "ansi", "color-xterm", "con132x25", 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() +{ +} 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; |