From 2ddf1d7f9e72b6a6f7524afd58daef1e309e4a4d Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sat, 5 Nov 2016 00:09:42 +0100 Subject: [PATCH] New upstream version 3.7.0~rc3 --- Help/manual/cmake-qt.7.rst | 2 +- Help/manual/cmake-server.7.rst | 241 ++++++++---------- Modules/CPackDeb.cmake | 8 +- Modules/CPackIFW.cmake | 68 +++-- Modules/CPackRPM.cmake | 6 +- Modules/Compiler/Intel-C.cmake | 9 +- Modules/Compiler/Intel-CXX-FeatureTests.cmake | 6 +- Modules/Compiler/Intel-CXX.cmake | 9 +- Modules/FindHDF5.cmake | 12 +- Modules/FindMatlab.cmake | 3 +- Modules/MatlabTestsRedirect.cmake | 4 +- Modules/Platform/Android-Common.cmake | 4 + .../Android/abi-arm64-v8a-Clang.cmake | 5 +- .../Platform/Android/abi-arm64-v8a-GNU.cmake | 6 +- .../Platform/Android/abi-armeabi-Clang.cmake | 1 - .../Platform/Android/abi-armeabi-GNU.cmake | 1 - .../Android/abi-armeabi-v6-Clang.cmake | 1 - .../Platform/Android/abi-armeabi-v6-GNU.cmake | 1 - .../Android/abi-armeabi-v7a-Clang.cmake | 1 - .../Android/abi-armeabi-v7a-GNU.cmake | 1 - Modules/Platform/Android/abi-common.cmake | 15 ++ Modules/Platform/Android/abi-mips-Clang.cmake | 4 - Modules/Platform/Android/abi-mips-GNU.cmake | 3 - .../Platform/Android/abi-mips64-Clang.cmake | 4 - Modules/Platform/Android/abi-mips64-GNU.cmake | 3 - Modules/Platform/Android/abi-x86-Clang.cmake | 4 - .../Platform/Android/abi-x86_64-Clang.cmake | 4 - .../Platform/Android/ndk-stl-c++_static.cmake | 2 + Modules/Platform/Darwin-Initialize.cmake | 8 +- Modules/Platform/Darwin.cmake | 24 -- Source/CMakeVersion.cmake | 2 +- Source/cmGlobalNinjaGenerator.cxx | 44 ++-- Source/cmGlobalNinjaGenerator.h | 1 - Source/cmServerDictionary.h | 6 +- Source/cmServerProtocol.cxx | 160 +++++++----- Tests/RunCMake/Android/RunCMakeTest.cmake | 5 - Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 + Tests/RunCMake/Ninja/SubDir.cmake | 1 + .../Ninja/SubDirBinary-build-stdout.txt | 1 + .../Ninja/SubDirBinary-install-stdout.txt | 1 + .../Ninja/SubDirBinary-test-stdout.txt | 1 + .../Ninja/SubDirSource/CMakeLists.txt | 6 + Tests/Server/cmakelib.py | 10 +- Tests/Server/cmakelib.pyc | Bin 7544 -> 7552 bytes Tests/Server/tc_handshake.json | 4 +- 45 files changed, 353 insertions(+), 358 deletions(-) create mode 100644 Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt create mode 100644 Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt create mode 100644 Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index e8a2c1e68..782706572 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -29,7 +29,7 @@ Qt 4 and Qt 5 may be used together in the same set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) - find_package(Qt5Widgets REQUIRED) + find_package(Qt5 COMPONENTS Widgets DBus REQUIRED) add_executable(publisher publisher.cpp) target_link_libraries(publisher Qt5::Widgets Qt5::DBus) diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index afd4e2b26..9520cc140 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -57,17 +57,17 @@ or using a named pipe (with the ``--pipe `` parameter). When connecting to the server (via named pipe or by starting it in ``--debug`` mode), the server will reply with a hello message:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"supportedProtocolVersions":[{"major":1,"minor":0}],"type":"hello"} - ]== CMake Server ==] + ]== "CMake Server" ==] Messages sent to and from the process are wrapped in magic strings:: - [== CMake Server ==[ + [== "CMake Server" ==[ { ... some JSON message ... } - ]== CMake Server ==] + ]== "CMake Server" ==] The server is now ready to accept further requests via the named pipe or stdin. @@ -87,7 +87,7 @@ the response into the given filename. This is a response from the cmake server with "showStats" set to true:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "errorMessage":"Waiting for type \"handshake\".", @@ -100,7 +100,7 @@ This is a response from the cmake server with "showStats" set to true:: "totalTime":0.025995 } } - ]== CMake Server ==] + ]== "CMake Server" ==] The server has made a copy of this response into the file /tmp/error.txt and took 0.011 seconds to turn the JSON response into a string, and it took 0.025 @@ -137,9 +137,9 @@ contain values. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "error" @@ -150,9 +150,9 @@ contain an "errorMessage". Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "progress" @@ -181,9 +181,9 @@ box title. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","message":"Something happened.","title":"Title Text","inReplyTo":"handshake","type":"message"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "signal" @@ -208,13 +208,13 @@ an influence on the build system is changed. The "dirty" signal may look like this:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "inReplyTo":"", "name":"dirty", "type":"signal"} - ]== CMake Server ==] + ]== "CMake Server" ==] "fileChange" Signal @@ -226,7 +226,7 @@ that was detected. Possible changes are "change" and "rename". The "fileChange" signal looks like this:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "inReplyTo":"", @@ -234,7 +234,7 @@ The "fileChange" signal looks like this:: "path":"/absolute/CMakeLists.txt", "properties":["change"], "type":"signal"} - ]== CMake Server ==] + ]== "CMake Server" ==] Specific Message Types @@ -250,13 +250,15 @@ This is the only message ever sent by the server that is not of type "reply", It will contain "supportedProtocolVersions" with an array of server protocol versions supported by the cmake server. These are JSON objects with "major" and -"minor" keys containing non-negative integer values. +"minor" keys containing non-negative integer values. Some versions may be marked +as experimental. These will contain the "isExperimental" key set to true. Enabling +these requires a special command line argument when starting the cmake server mode. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"supportedProtocolVersions":[{"major":0,"minor":1}],"type":"hello"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "handshake" @@ -274,21 +276,23 @@ Protocol version 1.0 requires the following attributes to be set: * "sourceDirectory" with a path to the sources * "buildDirectory" with a path to the build directory * "generator" with the generator name - * "extraGenerator" (optional!) with the extra generator to be used. + * "extraGenerator" (optional!) with the extra generator to be used + * "platform" with the generator platform (if supported by the generator) + * "toolset" with the generator toolset (if supported by the generator) Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","type":"handshake","protocolVersion":{"major":0}, "sourceDirectory":"/home/code/cmake", "buildDirectory":"/tmp/testbuild", "generator":"Ninja"} - ]== CMake Server ==] + ]== "CMake Server" ==] which will result in a response type "reply":: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] indicating that the server is ready for action. @@ -301,13 +305,13 @@ JSON structure with information on cmake state. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"globalSettings"} - ]== CMake Server ==] + ]== "CMake Server" ==] which will result in a response type "reply":: - [== CMake Server ==[ + [== "CMake Server" ==[ { "buildDirectory": "/tmp/test-build", "capabilities": { @@ -344,7 +348,7 @@ which will result in a response type "reply":: "warnUnused": false, "warnUnusedCli": true } - ]== CMake Server ==] + ]== "CMake Server" ==] Type "setGlobalSettings" @@ -362,15 +366,15 @@ The server will respond with an empty reply message or an error. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"setGlobalSettings","debugOutput":true} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply to this with:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"inReplyTo":"setGlobalSettings","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "configure" @@ -389,34 +393,34 @@ cache handling that are passed to the cmake command line client. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"configure", "cacheArguments":["-Dsomething=else"]} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply like this (after reporting progress for some time):: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","inReplyTo":"configure","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "compute" ^^^^^^^^^^^^^^ -This requist will generate build system files in the build directory and +This request will generate build system files in the build directory and is only available after a project was successfully "configure"d. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"compute"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply (after reporting progress information):: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","inReplyTo":"compute","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "codemodel" @@ -426,8 +430,19 @@ The "codemodel" request can be used after a project was "compute"d successfully. It will list the complete project structure as it is known to cmake. -The reply will contain a key "projects", which will contain a list of -project objects, one for each (sub-)project defined in the cmake build system. +The reply will contain a key "configurations", which will contain a list of +configuration objects. Configuration objects are used to destinquish between +different configurations the build directory might have enabled. While most +generators only support one configuration, others might support several. + +Each configuration object can have the following keys: + +"name" + contains the name of the configuration. The name may be empty. +"projects" + contains a list of project objects, one for each build project. + +Project objects define one (sub-)project defined in the cmake build system. Each project object can have the following keys: @@ -437,19 +452,8 @@ Each project object can have the following keys: contains the current source directory "buildDirectory" contains the current build directory. -"configurations" - contains a list of configuration objects. - -Configuration objects are used to destinquish between different -configurations the build directory might have enabled. While most generators -only support one configuration, others support several. - -Each configuration object can have the following keys: - -"name" - contains the name of the configuration. The name may be empty. "targets" - contains a list of target objects, one for each build target. + contains a list of build system target objects. Target objects define individual build targets for a certain configuration. @@ -519,88 +523,53 @@ sourceDirectory of the target. Example:: - [== CMake Server ==[ - {"type":"project"} - ]== CMake Server ==] + [== "CMake Server" ==[ + {"type":"codemodel"} + ]== "CMake Server" ==] CMake will reply:: - [== CMake Server ==[ + [== "CMake Server" ==[ { - "cookie":"", - "type":"reply", - "inReplyTo":"project", - - "projects": - [ + "configurations": [ { - "name":"CMAKE_FORM", - "sourceDirectory":"/home/code/src/cmake/Source/CursesDialog/form" - "buildDirectory":"/tmp/cmake-build-test/Source/CursesDialog/form", - "configurations": - [ + "name": "", + "projects": [ { - "name":"", - "targets": - [ + "buildDirectory": "/tmp/build/Source/CursesDialog/form", + "name": "CMAKE_FORM", + "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", + "targets": [ { - "artifactDirectory":"/tmp/cmake/Source/CursesDialog/form", - "fileGroups": - [ + "artifacts": [ "/tmp/build/Source/CursesDialog/form/libcmForm.a" ], + "buildDirectory": "/tmp/build/Source/CursesDialog/form", + "fileGroups": [ { - "compileFlags":" -std=gnu11", - "defines": - [ - "SOMETHING=1", - "LIBARCHIVE_STATIC" - ], - "includePath": - [ - { "path":"/tmp/cmake-build-test/Utilities" }, - { "isSystem": true, "path":"/usr/include/something" }, - ... - ] - "language":"C", - "sources": - [ - "fld_arg.c", - ... - "fty_regex.c" - ] + "compileFlags": " -std=gnu11", + "defines": [ "CURL_STATICLIB", "LIBARCHIVE_STATIC" ], + "includePath": [ { "path": "/tmp/build/Utilities" }, <...> ], + "isGenerated": false, + "language": "C", + "sources": [ "fld_arg.c", <...> ] } ], - "fullName":"libcmForm.a", - "linkerLanguage":"C", - "name":"cmForm", - "type":"STATIC_LIBRARY" + "fullName": "libcmForm.a", + "linkerLanguage": "C", + "name": "cmForm", + "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", + "type": "STATIC_LIBRARY" } ] - } - ], - }, - ... - ] + }, + <...> + ] + } + ], + "cookie": "", + "inReplyTo": "codemodel", + "type": "reply" } - ]== CMake Server ==] - -The output can be tailored to the specific needs via parameter passed when -requesting "project" information. - -You can have a "depth" key, which accepts "project", "configuration" and -"target" as string values. These cause the output to be trimmed at the -appropriate depth of the output tree. - -You can also set "configurations" to an array of strings with configuration -names to list. This will cause any configuration that is not listed to be -trimmed from the output. - -Generated files can be included in the listing by setting "includeGeneratedFiles" -to "true". This setting defaults to "false", so generated files are not -listed by default. - -Finally you can limit the target types that are going to be listed. This is -done by providing a list of target types as an array of strings to the -"targetTypes" key. + ]== "CMake Server" ==] Type "cmakeInputs" @@ -614,13 +583,13 @@ This request is only available after a project was successfully Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"cmakeInputs"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply with the following information:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"buildFiles": [ {"isCMake":true,"isTemporary":false,"sources":["/usr/lib/cmake/...", ... ]}, @@ -633,7 +602,7 @@ CMake will reply with the following information:: "inReplyTo":"cmakeInputs", "type":"reply" } - ]== CMake Server ==] + ]== "CMake Server" ==] All file names are either relative to the top level source directory or absolute. @@ -652,13 +621,13 @@ list the cached configuration values. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"cache"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will respond with the following output:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"","inReplyTo":"cache","type":"reply", "cache": @@ -674,7 +643,7 @@ CMake will respond with the following output:: "value":"TEST"} ] } - ]== CMake Server ==] + ]== "CMake Server" ==] The output can be limited to a list of keys by passing an array of key names to the "keys" optional field of the "cache" request. @@ -688,16 +657,16 @@ command will report on the files and directories watched. Example:: - [== CMake Server ==] + [== "CMake Server" ==[ {"type":"fileSystemWatchers"} - [== CMake Server ==] + ]== "CMake Server" ==] CMake will respond with the following output:: - [== CMake Server ==] + [== "CMake Server" ==[ { "cookie":"","inReplyTo":"fileSystemWatchers","type":"reply", "watchedFiles": [ "/absolute/path" ], "watchedDirectories": [ "/absolute" ] } - [== CMake Server ==] + ]== "CMake Server" ==] diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 653283c01..909a12b4f 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -32,11 +32,11 @@ # - https://cmake.org/Wiki/CMake:CPackConfiguration # - https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 # -# List of CPackRPM specific variables: +# List of CPackDEB specific variables: # -# .. variable:: CPACK_DEB_PACKAGE_COMPONENT +# .. variable:: CPACK_DEB_COMPONENT_INSTALL # -# Enable component packaging for CPackRPM +# Enable component packaging for CPackDEB # # * Mandatory : NO # * Default : OFF @@ -616,7 +616,7 @@ function(cpack_deb_prepare_package_vars) find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) if(SHLIBDEPS_EXECUTABLE) - # Check version of the dpkg-shlibdeps tool using CPackRPM method + # Check version of the dpkg-shlibdeps tool using CPackDEB method execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 6c93ddb97..08078cbe8 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -433,11 +433,15 @@ # Default path -set(_CPACK_IFW_PATHS - "${QTIFWDIR}" - "$ENV{QTIFWDIR}" - "${QTDIR}" - "$ENV{QTIFWDIR}") +foreach(_CPACK_IFW_PATH_VAR "QTIFWDIR" "QTDIR") + if(DEFINED ${_CPACK_IFW_PATH_VAR} + AND NOT "${${_CPACK_IFW_PATH_VAR}}" STREQUAL "") + list(APPEND _CPACK_IFW_PATHS "${${_CPACK_IFW_PATH_VAR}}") + endif() + if(NOT "$ENV{${_CPACK_IFW_PATH_VAR}}" STREQUAL "") + list(APPEND _CPACK_IFW_PATHS "$ENV{${_CPACK_IFW_PATH_VAR}}") + endif() +endforeach() if(WIN32) list(APPEND _CPACK_IFW_PATHS "$ENV{HOMEDRIVE}/Qt" @@ -447,22 +451,44 @@ else() "$ENV{HOME}/Qt" "/opt/Qt") endif() - -set(_CPACK_IFW_SUFFIXES -# Common - "bin" -# Second branch - "QtIFW2.3.0/bin" - "QtIFW2.2.0/bin" - "QtIFW2.1.0/bin" - "QtIFW2.0.3/bin" - "QtIFW2.0.1/bin" - "QtIFW2.0.0/bin" -# First branch - "QtIFW-1.6.0/bin" - "QtIFW-1.5.0/bin" - "QtIFW-1.4.0/bin" - "QtIFW-1.3.0/bin") +list(REMOVE_DUPLICATES _CPACK_IFW_PATHS) + +set(_CPACK_IFW_PREFIXES + # QtSDK + "Tools/QtInstallerFramework/" + # Second branch + "QtIFW" + # First branch + "QtIFW-") + +set(_CPACK_IFW_VERSIONS + "2.3" + "2.3.0" + "2.2" + "2.2.0" + "2.1" + "2.1.0" + "2.0" + "2.0.3" + "2.0.2" + "2.0.1" + "2.0.0" + "1.6" + "1.6.0" + "1.5" + "1.5.0" + "1.4" + "1.4.0" + "1.3" + "1.3.0") + +set(_CPACK_IFW_SUFFIXES "bin") +foreach(_CPACK_IFW_PREFIX ${_CPACK_IFW_PREFIXES}) + foreach(_CPACK_IFW_VERSION ${_CPACK_IFW_VERSIONS}) + list(APPEND + _CPACK_IFW_SUFFIXES "${_CPACK_IFW_PREFIX}${_CPACK_IFW_VERSION}/bin") + endforeach() +endforeach() # Look for 'binarycreator' diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 15b62c752..06406304d 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -45,7 +45,7 @@ # # List of CPackRPM specific variables: # -# .. variable:: CPACK_RPM_PACKAGE_COMPONENT +# .. variable:: CPACK_RPM_COMPONENT_INSTALL # # Enable component packaging for CPackRPM # @@ -461,7 +461,7 @@ # May be used to embed a pre (un)installation script in the spec file. # The referred script file (or both) will be read and directly # put after the ``%pre`` or ``%preun`` section -# If :variable:`CPACK_RPM_PACKAGE_COMPONENT` is set to ON the (un)install +# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install # script for each component can be overridden with # ``CPACK_RPM__PRE_INSTALL_SCRIPT_FILE`` and # ``CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE``. @@ -480,7 +480,7 @@ # May be used to embed a post (un)installation script in the spec file. # The referred script file (or both) will be read and directly # put after the ``%post`` or ``%postun`` section. -# If :variable:`CPACK_RPM_PACKAGE_COMPONENT` is set to ON the (un)install +# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install # script for each component can be overridden with # ``CPACK_RPM__POST_INSTALL_SCRIPT_FILE`` and # ``CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE``. diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 1d09bd555..61adf40d8 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -9,20 +9,22 @@ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT -MF ") if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) + set(_ext c) else() set(_std -std) + set(_ext gnu) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=gnu11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11") endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "${_std}=c89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=gnu89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=${_ext}89") set(CMAKE_C99_STANDARD_COMPILE_OPTION "${_std}=c99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=gnu99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=${_ext}99") endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) @@ -42,6 +44,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) endif() unset(_std) +unset(_ext) macro(cmake_record_c_compile_features) macro(_get_intel_c_features std_version list) diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index e111c07c8..57a05c892 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -1,6 +1,7 @@ # References: # - https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler # - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler +# - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0096r3.html # FIXME: Intel C++ feature detection works only when simulating the GNU compiler. # When simulating MSVC, Intel always sets __cplusplus to 199711L. @@ -8,9 +9,8 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") return() endif() -# these are not implemented in any version at time of writing -#set(_cmake_feature_test_cxx_variable_templates "${Intel15_CXX14}") -#set(_cmake_feature_test_cxx_relaxed_constexpr "${Intel15_CXX14}") +set(_cmake_feature_test_cxx_variable_templates "__cpp_variable_templates >= 201304") +set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304") set(_cmake_oldestSupported "__INTEL_COMPILER >= 1210") set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) || defined(__GXX_EXPERIMENTAL_CXX0X__))") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 3cc450313..73dd7faef 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -9,8 +9,10 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT -MF ") if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) + set(_ext c++) else() set(_std -std) + set(_ext gnu++) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) @@ -25,15 +27,15 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}0x") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=${_ext}98") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) @@ -50,6 +52,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) endif() unset(_std) +unset(_ext) macro(cmake_record_cxx_compile_features) macro(_get_intel_features std_version list) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 1c2c443f3..16764e083 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -100,18 +100,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran) # Validate the list of find components. -set(HDF5_LANGUAGE_BINDINGS) if(NOT HDF5_FIND_COMPONENTS) - get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) - foreach(__lang IN LISTS __langs) - if(__lang MATCHES "^(C|CXX|Fortran)$") - list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang}) - set(HDF5_FIND_REQUIRED_${__lang} True) - endif() - endforeach() - set(FIND_HL ON) - set(HDF5_FIND_REQUIRED_HL True) + set(HDF5_LANGUAGE_BINDINGS "C") else() + set(HDF5_LANGUAGE_BINDINGS) # add the extra specified components, ensuring that they are valid. set(FIND_HL OFF) foreach(component IN LISTS HDF5_FIND_COMPONENTS) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index b7f2db59d..eae158535 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -225,6 +225,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2016b=9.1" "R2016a=9.0" "R2015b=8.6" "R2015a=8.5" @@ -793,7 +794,7 @@ function(matlab_add_unit_test) "-Dworking_directory=${${prefix}_WORKING_DIRECTORY}" "-DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}" "-Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}" - "-DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}" + "-DMatlab_ADDITIONAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}" "-Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}" "-Dcustom_Matlab_test_command=${${prefix}_CUSTOM_TEST_COMMAND}" "-Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}" diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index a0c662156..64d580db6 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -10,14 +10,14 @@ # -Dadditional_paths="" # -Dno_unittest_framework="" # -DMatlab_PROGRAM=matlab_exe_location -# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS="" +# -DMatlab_ADDITIONAL_STARTUP_OPTIONS="" # -Dtest_name=name_of_the_test # -Dcustom_Matlab_test_command="" # -Dcmd_to_run_before_test="" # -Dunittest_file_to_run # -P FindMatlab_TestsRedirect.cmake -set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) +set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONAL_STARTUP_OPTIONS}) if(WIN32) set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) endif() diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 6544696cd..8755d4f5e 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -107,6 +107,7 @@ set(_ANDROID_ABI_INIT_CFLAGS "") set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "") set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "") set(_ANDROID_ABI_INIT_LDFLAGS "") +set(_ANDROID_ABI_INIT_EXE_LDFLAGS "") macro(__android_compiler_common lang) if(_ANDROID_ABI_INIT_CFLAGS) @@ -125,6 +126,9 @@ macro(__android_compiler_common lang) string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_LDFLAGS}") endforeach() endif() + if(_ANDROID_ABI_INIT_EXE_LDFLAGS) + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_EXE_LDFLAGS}") + endif() if(DEFINED _ANDROID_STL_EXCEPTIONS) if(_ANDROID_STL_EXCEPTIONS) diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake index 3ff1fe50b..f4717d5f6 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake @@ -1,8 +1,7 @@ # /build/core/toolchains/aarch64-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) +# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a +set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake index 538ec2f40..b71a67462 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake @@ -1,6 +1,6 @@ # /build/core/toolchains/aarch64-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) + +# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a +set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake index 4fc300908..b857bd373 100644 --- a/Modules/Platform/Android/abi-armeabi-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake @@ -14,7 +14,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -msoft-float" " -mtune=xscale" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-GNU.cmake b/Modules/Platform/Android/abi-armeabi-GNU.cmake index 10cac0085..33e8b314e 100644 --- a/Modules/Platform/Android/abi-armeabi-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-GNU.cmake @@ -12,7 +12,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -msoft-float" " -mtune=xscale" - " -fpic" ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake index 15f1d4a00..a7412f5bd 100644 --- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake @@ -13,7 +13,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake index 7492de087..1fda184b6 100644 --- a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake @@ -11,7 +11,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake index 3a3efb326..e2ab58b32 100644 --- a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake @@ -23,7 +23,6 @@ string(APPEND _ANDROID_ABI_INIT_LDFLAGS string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake index d27e37e25..b7c328d88 100644 --- a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake @@ -17,7 +17,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) string(APPEND _ANDROID_ABI_INIT_LDFLAGS diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake index 12d8e5ce3..3b0eb018e 100644 --- a/Modules/Platform/Android/abi-common.cmake +++ b/Modules/Platform/Android/abi-common.cmake @@ -2,3 +2,18 @@ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -funwind-tables" " -no-canonical-prefixes" ) + +if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE + AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 16) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() + +if(CMAKE_POSITION_INDEPENDENT_CODE) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -fPIE -pie") +endif() + +string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,--gc-sections") + +if(NOT _ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,-z,nocopyreloc") +endif() diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake index bf6b9fc74..73adddecf 100644 --- a/Modules/Platform/Android/abi-mips-Clang.cmake +++ b/Modules/Platform/Android/abi-mips-Clang.cmake @@ -1,8 +1,4 @@ # /build/core/toolchains/mipsel-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-mips-GNU.cmake b/Modules/Platform/Android/abi-mips-GNU.cmake index d380440a3..982ad4658 100644 --- a/Modules/Platform/Android/abi-mips-GNU.cmake +++ b/Modules/Platform/Android/abi-mips-GNU.cmake @@ -1,6 +1,3 @@ # /build/core/toolchains/mipsel-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake index 1a94107ce..603f1b209 100644 --- a/Modules/Platform/Android/abi-mips64-Clang.cmake +++ b/Modules/Platform/Android/abi-mips64-Clang.cmake @@ -1,8 +1,4 @@ # /build/core/toolchains/mips64el-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-mips64-GNU.cmake b/Modules/Platform/Android/abi-mips64-GNU.cmake index 4525d40a8..a1bc2c2fb 100644 --- a/Modules/Platform/Android/abi-mips64-GNU.cmake +++ b/Modules/Platform/Android/abi-mips64-GNU.cmake @@ -1,6 +1,3 @@ # /build/core/toolchains/mips64el-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake index f63ed36e5..fe7eacef5 100644 --- a/Modules/Platform/Android/abi-x86-Clang.cmake +++ b/Modules/Platform/Android/abi-x86-Clang.cmake @@ -1,8 +1,4 @@ # /build/core/toolchains/x86-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fPIC" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake index c15042b29..3cbcd491f 100644 --- a/Modules/Platform/Android/abi-x86_64-Clang.cmake +++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake @@ -1,8 +1,4 @@ # /build/core/toolchains/x86_64-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fPIC" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/ndk-stl-c++_static.cmake b/Modules/Platform/Android/ndk-stl-c++_static.cmake index 8e562f80d..061a5c292 100644 --- a/Modules/Platform/Android/ndk-stl-c++_static.cmake +++ b/Modules/Platform/Android/ndk-stl-c++_static.cmake @@ -3,4 +3,6 @@ macro(__android_stl lang) __android_stl_cxx(${lang} libc++_static.a) __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libc++abi.a" 0) __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libandroid_support.a" 0) + __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libunwind.a" 0) + string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -latomic") # provided by toolchain endmacro() diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index 39374e154..b539e457d 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -113,7 +113,6 @@ set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT "The product will be built against the headers and libraries located inside the indicated SDK.") # Transform the cached value to something we can use. -set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") set(_CMAKE_OSX_SYSROOT_PATH "") if(CMAKE_OSX_SYSROOT) if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") @@ -122,13 +121,10 @@ if(CMAKE_OSX_SYSROOT) message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" "because the directory does not exist.") set(CMAKE_OSX_SYSROOT "") - set(_CMAKE_OSX_SYSROOT_ORIG "") endif() set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") - endif() - - if(CMAKE_OSX_SYSROOT) - # Transform the (maybe unversioned) sysroot into a versioned path. + else() + # Transform the sdk name into a path. execute_process( COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path OUTPUT_VARIABLE _stdout diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index bb085ac7c..26b12a195 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -64,30 +64,6 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) endif() -# Make sure the combination of SDK and Deployment Target are allowed -if(CMAKE_OSX_DEPLOYMENT_TARGET) - if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") - set(_sdk_ver "${CMAKE_MATCH_1}") - elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") - set(_sdk_ver "${CMAKE_MATCH_1}") - elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/") - set(_sdk_ver "${_CURRENT_OSX_VERSION}") - else() - message(FATAL_ERROR - "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " - "but CMAKE_OSX_SYSROOT:\n \"${_CMAKE_OSX_SYSROOT_ORIG}\"\n" - "is not set to a MacOSX SDK with a recognized version. " - "Either set CMAKE_OSX_SYSROOT to a valid SDK or set " - "CMAKE_OSX_DEPLOYMENT_TARGET to empty.") - endif() - if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "${_sdk_ver}") - message(FATAL_ERROR - "CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) " - "is greater than CMAKE_OSX_SYSROOT SDK:\n ${_CMAKE_OSX_SYSROOT_ORIG}\n" - "Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${_sdk_ver} or lower.") - endif() -endif() - # Enable shared library versioning. set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d8c77fce2..eecbe928f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,4 +2,4 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 7) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 2) +set(CMake_VERSION_RC 3) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f5a0e68af..5e6036df8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -843,20 +843,6 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path) return convPath; } -std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule( - const std::string& path) -{ - cmLocalNinjaGenerator* ng = - static_cast(this->LocalGenerators[0]); - std::string convPath = ng->ConvertToRelativePath( - this->LocalGenerators[0]->GetState()->GetSourceDirectory(), path + "/all"); - convPath = this->NinjaOutputPath(convPath); -#ifdef _WIN32 - std::replace(convPath.begin(), convPath.end(), '/', '\\'); -#endif - return convPath; -} - void cmGlobalNinjaGenerator::AddCXXCompileCommand( const std::string& commandLine, const std::string& sourceFile) { @@ -1083,11 +1069,11 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) this->LocalGenerators.begin(); lgi != this->LocalGenerators.end(); ++lgi) { cmLocalGenerator const* lg = *lgi; - const std::string currentSourceFolder( - lg->GetStateSnapshot().GetDirectory().GetCurrentSource()); + const std::string currentBinaryFolder( + lg->GetStateSnapshot().GetDirectory().GetCurrentBinary()); // The directory-level rule should depend on the target-level rules // for all targets in the directory. - targetsPerFolder[currentSourceFolder] = cmNinjaDeps(); + targetsPerFolder[currentBinaryFolder] = cmNinjaDeps(); for (std::vector::const_iterator ti = lg->GetGeneratorTargets().begin(); ti != lg->GetGeneratorTargets().end(); ++ti) { @@ -1098,7 +1084,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) type == cmState::MODULE_LIBRARY || type == cmState::OBJECT_LIBRARY || type == cmState::UTILITY) && !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { - targetsPerFolder[currentSourceFolder].push_back(gt->GetName()); + targetsPerFolder[currentBinaryFolder].push_back(gt->GetName()); } } @@ -1109,28 +1095,30 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) for (std::vector::const_iterator stateIt = children.begin(); stateIt != children.end(); ++stateIt) { - targetsPerFolder[currentSourceFolder].push_back( - this->ConvertToNinjaFolderRule( - stateIt->GetDirectory().GetCurrentSource())); + std::string const currentBinaryDir = + stateIt->GetDirectory().GetCurrentBinary(); + + targetsPerFolder[currentBinaryFolder].push_back( + this->ConvertToNinjaPath(currentBinaryDir + "/all")); } } - std::string const rootSourceDir = - this->LocalGenerators[0]->GetSourceDirectory(); + std::string const rootBinaryDir = + this->LocalGenerators[0]->GetBinaryDirectory(); for (std::map::const_iterator it = targetsPerFolder.begin(); it != targetsPerFolder.end(); ++it) { cmGlobalNinjaGenerator::WriteDivider(os); - std::string const& currentSourceDir = it->first; + std::string const& currentBinaryDir = it->first; - // Do not generate a rule for the root source dir. - if (rootSourceDir.length() >= currentSourceDir.length()) { + // Do not generate a rule for the root binary dir. + if (rootBinaryDir.length() >= currentBinaryDir.length()) { continue; } - std::string const comment = "Folder: " + currentSourceDir; + std::string const comment = "Folder: " + currentBinaryDir; cmNinjaDeps output(1); - output.push_back(this->ConvertToNinjaFolderRule(currentSourceDir)); + output.push_back(this->ConvertToNinjaPath(currentBinaryDir + "/all")); this->WritePhonyBuild(os, comment, output, it->second); } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index dcf7406c8..2ce3c808b 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -234,7 +234,6 @@ public: } std::string ConvertToNinjaPath(const std::string& path); - std::string ConvertToNinjaFolderRule(const std::string& path); struct MapToNinjaPathImpl { diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h index c82274ab6..e6a7ae6ca 100644 --- a/Source/cmServerDictionary.h +++ b/Source/cmServerDictionary.h @@ -62,6 +62,7 @@ static const std::string kMESSAGE_KEY = "message"; static const std::string kMINOR_KEY = "minor"; static const std::string kNAME_KEY = "name"; static const std::string kPATH_KEY = "path"; +static const std::string kPLATFORM_KEY = "platform"; static const std::string kPROGRESS_CURRENT_KEY = "progressCurrent"; static const std::string kPROGRESS_MAXIMUM_KEY = "progressMaximum"; static const std::string kPROGRESS_MESSAGE_KEY = "progressMessage"; @@ -77,6 +78,7 @@ static const std::string kSUPPORTED_PROTOCOL_VERSIONS = static const std::string kSYSROOT_KEY = "sysroot"; static const std::string kTARGETS_KEY = "targets"; static const std::string kTITLE_KEY = "title"; +static const std::string kTOOLSET_KEY = "toolset"; static const std::string kTRACE_EXPAND_KEY = "traceExpand"; static const std::string kTRACE_KEY = "trace"; static const std::string kTYPE_KEY = "type"; @@ -87,8 +89,8 @@ static const std::string kWARN_UNUSED_KEY = "warnUnused"; static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; static const std::string kWATCHED_FILES_KEY = "watchedFiles"; -static const std::string kSTART_MAGIC = "[== CMake Server ==["; -static const std::string kEND_MAGIC = "]== CMake Server ==]"; +static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==["; +static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]"; static const std::string kRENAME_PROPERTY_VALUE = "rename"; static const std::string kCHANGE_PROPERTY_VALUE = "change"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index a2bdf49e2..09b08fe8d 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -244,6 +244,30 @@ std::pair cmServerProtocol1_0::ProtocolVersion() const return std::make_pair(1, 0); } +static void setErrorMessage(std::string* errorMessage, const std::string& text) +{ + if (errorMessage) { + *errorMessage = text; + } +} + +static bool testValue(cmState* state, const std::string& key, + std::string& value, const std::string& keyDescription, + std::string* errorMessage) +{ + const std::string cachedValue = std::string(state->GetCacheEntryValue(key)); + if (!cachedValue.empty() && !value.empty() && cachedValue != value) { + setErrorMessage(errorMessage, std::string("\"") + key + + "\" is set but incompatible with configured " + + keyDescription + " value."); + return false; + } + if (value.empty()) { + value = cachedValue; + } + return true; +} + bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request, std::string* errorMessage) { @@ -252,21 +276,20 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request, request.Data[kBUILD_DIRECTORY_KEY].asString(); std::string generator = request.Data[kGENERATOR_KEY].asString(); std::string extraGenerator = request.Data[kEXTRA_GENERATOR_KEY].asString(); + std::string toolset = request.Data[kTOOLSET_KEY].asString(); + std::string platform = request.Data[kPLATFORM_KEY].asString(); if (buildDirectory.empty()) { - if (errorMessage) { - *errorMessage = - std::string("\"") + kBUILD_DIRECTORY_KEY + "\" is missing."; - } + setErrorMessage(errorMessage, std::string("\"") + kBUILD_DIRECTORY_KEY + + "\" is missing."); return false; } + cmake* cm = CMakeInstance(); if (cmSystemTools::PathExists(buildDirectory)) { if (!cmSystemTools::FileIsDirectory(buildDirectory)) { - if (errorMessage) { - *errorMessage = std::string("\"") + kBUILD_DIRECTORY_KEY + - "\" exists but is not a directory."; - } + setErrorMessage(errorMessage, std::string("\"") + kBUILD_DIRECTORY_KEY + + "\" exists but is not a directory."); return false; } @@ -275,77 +298,86 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request, cmState* state = cm->GetState(); // Check generator: - const std::string cachedGenerator = - std::string(state->GetCacheEntryValue("CMAKE_GENERATOR")); - if (cachedGenerator.empty() && generator.empty()) { - if (errorMessage) { - *errorMessage = - std::string("\"") + kGENERATOR_KEY + "\" is required but unset."; - } - return false; - } - if (generator.empty()) { - generator = cachedGenerator; - } - if (generator != cachedGenerator) { - if (errorMessage) { - *errorMessage = std::string("\"") + kGENERATOR_KEY + - "\" set but incompatible with configured generator."; - } + if (!testValue(state, "CMAKE_GENERATOR", generator, "generator", + errorMessage)) { return false; } // check extra generator: - const std::string cachedExtraGenerator = - std::string(state->GetCacheEntryValue("CMAKE_EXTRA_GENERATOR")); - if (!cachedExtraGenerator.empty() && !extraGenerator.empty() && - cachedExtraGenerator != extraGenerator) { - if (errorMessage) { - *errorMessage = std::string("\"") + kEXTRA_GENERATOR_KEY + - "\" is set but incompatible with configured extra generator."; - } + if (!testValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator, + "extra generator", errorMessage)) { return false; } - if (extraGenerator.empty()) { - extraGenerator = cachedExtraGenerator; - } // check sourcedir: - const std::string cachedSourceDirectory = - std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY")); - if (!cachedSourceDirectory.empty() && !sourceDirectory.empty() && - cachedSourceDirectory != sourceDirectory) { - if (errorMessage) { - *errorMessage = std::string("\"") + kSOURCE_DIRECTORY_KEY + - "\" is set but incompatible with configured source directory."; - } + if (!testValue(state, "CMAKE_HOME_DIRECTORY", sourceDirectory, + "source directory", errorMessage)) { return false; } - if (sourceDirectory.empty()) { - sourceDirectory = cachedSourceDirectory; + + // check toolset: + if (!testValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset", + errorMessage)) { + return false; + } + + // check platform: + if (!testValue(state, "CMAKE_GENERATOR_PLATFORM", platform, "platform", + errorMessage)) { + return false; } } } if (sourceDirectory.empty()) { - if (errorMessage) { - *errorMessage = std::string("\"") + kSOURCE_DIRECTORY_KEY + - "\" is unset but required."; - } + setErrorMessage(errorMessage, std::string("\"") + kSOURCE_DIRECTORY_KEY + + "\" is unset but required."); return false; } if (!cmSystemTools::FileIsDirectory(sourceDirectory)) { - if (errorMessage) { - *errorMessage = - std::string("\"") + kSOURCE_DIRECTORY_KEY + "\" is not a directory."; - } + setErrorMessage(errorMessage, std::string("\"") + kSOURCE_DIRECTORY_KEY + + "\" is not a directory."); return false; } if (generator.empty()) { - if (errorMessage) { - *errorMessage = - std::string("\"") + kGENERATOR_KEY + "\" is unset but required."; - } + setErrorMessage(errorMessage, std::string("\"") + kGENERATOR_KEY + + "\" is unset but required."); + return false; + } + + std::vector generators; + cm->GetRegisteredGenerators(generators); + auto baseIt = std::find_if(generators.begin(), generators.end(), + [&generator](const cmake::GeneratorInfo& info) { + return info.name == generator; + }); + if (baseIt == generators.end()) { + setErrorMessage(errorMessage, std::string("Generator \"") + generator + + "\" not supported."); + return false; + } + auto extraIt = std::find_if( + generators.begin(), generators.end(), + [&generator, &extraGenerator](const cmake::GeneratorInfo& info) { + return info.baseName == generator && info.extraName == extraGenerator; + }); + if (extraIt == generators.end()) { + setErrorMessage(errorMessage, + std::string("The combination of generator \"" + generator + + "\" and extra generator \"" + extraGenerator + + "\" is not supported.")); + return false; + } + if (!extraIt->supportsToolset && !toolset.empty()) { + setErrorMessage(errorMessage, + std::string("Toolset was provided but is not supported by " + "the requested generator.")); + return false; + } + if (!extraIt->supportsPlatform && !platform.empty()) { + setErrorMessage(errorMessage, + std::string("Platform was provided but is not supported " + "by the requested generator.")); return false; } @@ -353,13 +385,15 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request, cmExternalMakefileProjectGenerator::CreateFullGeneratorName( generator, extraGenerator); + cm->SetGeneratorToolset(toolset); + cm->SetGeneratorPlatform(platform); + cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName); if (!gg) { - if (errorMessage) { - *errorMessage = - std::string("Could not set up the requested combination of \"") + - kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\""; - } + setErrorMessage( + errorMessage, + std::string("Could not set up the requested combination of \"") + + kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\""); return false; } diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 39b77cd0a..86a989623 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -174,11 +174,6 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) continue() endif() - # Skip combinations that seem to be broken. - if("${stl};${abi}" MATCHES [[^c\+\+_static;armeabi]]) - continue() - endif() - # Run the tests for this combination. if("${abi}" STREQUAL "armeabi") run_Android(ndk-armeabi-thumb) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_ARM_MODE=0 diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 778f2c111..1d3639d29 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -45,14 +45,23 @@ function(run_SubDir) set(SubDir_all [[SubDir\all]]) set(SubDir_test [[SubDir\test]]) set(SubDir_install [[SubDir\install]]) + set(SubDirBinary_test [[SubDirBinary\test]]) + set(SubDirBinary_all [[SubDirBinary\all]]) + set(SubDirBinary_install [[SubDirBinary\install]]) else() set(SubDir_all [[SubDir/all]]) set(SubDir_test [[SubDir/test]]) set(SubDir_install [[SubDir/install]]) + set(SubDirBinary_all [[SubDirBinary/all]]) + set(SubDirBinary_test [[SubDirBinary/test]]) + set(SubDirBinary_install [[SubDirBinary/install]]) endif() run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all}) run_cmake_command(SubDir-test ${CMAKE_COMMAND} --build . --target ${SubDir_test}) run_cmake_command(SubDir-install ${CMAKE_COMMAND} --build . --target ${SubDir_install}) + run_cmake_command(SubDirBinary-build ${CMAKE_COMMAND} --build . --target ${SubDirBinary_all}) + run_cmake_command(SubDirBinary-test ${CMAKE_COMMAND} --build . --target ${SubDirBinary_test}) + run_cmake_command(SubDirBinary-install ${CMAKE_COMMAND} --build . --target ${SubDirBinary_install}) endfunction() run_SubDir() diff --git a/Tests/RunCMake/Ninja/SubDir.cmake b/Tests/RunCMake/Ninja/SubDir.cmake index d227753b2..11f467a4b 100644 --- a/Tests/RunCMake/Ninja/SubDir.cmake +++ b/Tests/RunCMake/Ninja/SubDir.cmake @@ -1,5 +1,6 @@ include(CTest) add_subdirectory(SubDir) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/SubDirSource SubDirBinary) add_custom_target(TopFail ALL COMMAND does_not_exist) add_test(NAME TopTest COMMAND ${CMAKE_COMMAND} -E echo "Running TopTest") install(CODE [[ diff --git a/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt new file mode 100644 index 000000000..244eaa071 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt @@ -0,0 +1 @@ +Building SubDirSourceInAll diff --git a/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt new file mode 100644 index 000000000..6b6c6ddbe --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt @@ -0,0 +1 @@ +-- Installing SubDirSource diff --git a/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt new file mode 100644 index 000000000..d6d6605ae --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt @@ -0,0 +1 @@ +1/1 Test #1: SubDirSourceTest diff --git a/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt new file mode 100644 index 000000000..26642610e --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt @@ -0,0 +1,6 @@ +add_custom_target(SubDirSourceFail COMMAND does_not_exist) +add_custom_target(SubDirSourceInAll ALL COMMAND ${CMAKE_COMMAND} -E echo "Building SubDirSourceInAll") +add_test(NAME SubDirSourceTest COMMAND ${CMAKE_COMMAND} -E echo "Running SubDirSourceTest") +install(CODE [[ + message(STATUS "Installing SubDirSource") +]]) diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py index 94384ebab..d11431d0c 100644 --- a/Tests/Server/cmakelib.py +++ b/Tests/Server/cmakelib.py @@ -46,11 +46,11 @@ def waitForRawMessage(cmakeCommand): stdoutdata += stdoutdataLine.decode('utf-8') else: break - begin = stdoutdata.find("[== CMake Server ==[\n") - end = stdoutdata.find("]== CMake Server ==]") + begin = stdoutdata.find('[== "CMake Server" ==[\n') + end = stdoutdata.find(']== "CMake Server" ==]') if (begin != -1 and end != -1): - begin += len("[== CMake Server ==[\n") + begin += len('[== "CMake Server" ==[\n') payload = stdoutdata[begin:end] if print_communication: print("\nSERVER>", json.loads(payload), "\n") @@ -59,9 +59,9 @@ def waitForRawMessage(cmakeCommand): def writeRawData(cmakeCommand, content): writeRawData.counter += 1 payload = """ -[== CMake Server ==[ +[== "CMake Server" ==[ %s -]== CMake Server ==] +]== "CMake Server" ==] """ % content rn = ( writeRawData.counter % 2 ) == 0 diff --git a/Tests/Server/cmakelib.pyc b/Tests/Server/cmakelib.pyc index 5c1975ee9917503ad88405df69fd0311c8540204..a6eefec81e5a29a328f1437c7caca1521622a52e 100644 GIT binary patch delta 415 zcmexi)nLue{F#@lzfoo*`vXRf#FRACG$T{v$seU9Cl|2tO%`LCfGK#DsU1adb1m~F z486aRl}K&wWz%Og5@%pwh_j?GkJ3h{Iwrfy8Up}5`GKea delta 407 zcmZp${$a(={F#@lsgivo`vXP}3v;uSL_WMNiFhtwhDmeQlW~V9yrxul^7Ae@;MspR50A*s)WH!HJ7eF&s zp7X7)9#AP4R#Q}qxzNp+Y|Dk>kPE1;GUPdfW`i8xUsNSF{O3@WY}OWZMHQK>Ey%NZ iu23+l=w?BYhbSUan?=O#vZ9(UBqNEUMsl)`tO)?<(r!us diff --git a/Tests/Server/tc_handshake.json b/Tests/Server/tc_handshake.json index 5261581c5..975bb3d32 100644 --- a/Tests/Server/tc_handshake.json +++ b/Tests/Server/tc_handshake.json @@ -59,10 +59,10 @@ { "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"generator\" is unset but required."} }, { "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"XXXX","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Could not set up the requested combination of \"generator\" and \"extraGenerator\""} }, +{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Generator \"XXXX\" not supported."} }, { "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"XXXX"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Could not set up the requested combination of \"generator\" and \"extraGenerator\""} }, +{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: The combination of generator \"Ninja\" and extra generator \"XXXX\" is not supported."} }, { "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"CodeBlocks"} }, { "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} },