Merge branch 'doc-cmake-qt-fixes' into release
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index afd4e2b..9520cc1 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -57,17 +57,17 @@
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 @@
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 @@
"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 @@
Example::
- [== CMake Server ==[
+ [== "CMake Server" ==[
{"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"}
- ]== CMake Server ==]
+ ]== "CMake Server" ==]
Type "error"
@@ -150,9 +150,9 @@
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 @@
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 @@
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 @@
The "fileChange" signal looks like this::
- [== CMake Server ==[
+ [== "CMake Server" ==[
{
"cookie":"",
"inReplyTo":"",
@@ -234,7 +234,7 @@
"path":"/absolute/CMakeLists.txt",
"properties":["change"],
"type":"signal"}
- ]== CMake Server ==]
+ ]== "CMake Server" ==]
Specific Message Types
@@ -250,13 +250,15 @@
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 @@
* "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 @@
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 @@
"warnUnused": false,
"warnUnusedCli": true
}
- ]== CMake Server ==]
+ ]== "CMake Server" ==]
Type "setGlobalSettings"
@@ -362,15 +366,15 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
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 @@
"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 @@
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 653283c..909a12b 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 @@
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/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 15b62c7..0640630 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_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
# ``CPACK_RPM_<COMPONENT>_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_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
# ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 1d09bd5..61adf40 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -9,20 +9,22 @@
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 @@
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 e111c07..57a05c8 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 @@
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 3cc4503..73dd7fa 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -9,8 +9,10 @@
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 @@
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 @@
endif()
unset(_std)
+unset(_ext)
macro(cmake_record_cxx_compile_features)
macro(_get_intel_features std_version list)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index b7f2db5..eae1585 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -225,6 +225,7 @@
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2016b=9.1"
"R2016a=9.0"
"R2015b=8.6"
"R2015a=8.5"
@@ -793,7 +794,7 @@
"-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 a0c6621..64d580d 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 6544696..8755d4f 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -107,6 +107,7 @@
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 @@
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 3ff1fe5..f4717d5 100644
--- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
+++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
@@ -1,8 +1,7 @@
# <ndk>/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 538ec2f..b71a674 100644
--- a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
+++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
@@ -1,6 +1,6 @@
# <ndk>/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 4fc3009..b857bd3 100644
--- a/Modules/Platform/Android/abi-armeabi-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake
@@ -14,7 +14,6 @@
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 10cac00..33e8b31 100644
--- a/Modules/Platform/Android/abi-armeabi-GNU.cmake
+++ b/Modules/Platform/Android/abi-armeabi-GNU.cmake
@@ -12,7 +12,6 @@
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 15f1d4a..a7412f5 100644
--- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
@@ -13,7 +13,6 @@
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 7492de0..1fda184 100644
--- a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
@@ -11,7 +11,6 @@
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 3a3efb3..e2ab58b 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_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 d27e37e..b7c328d 100644
--- a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
@@ -17,7 +17,6 @@
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 12d8e5c..3b0eb01 100644
--- a/Modules/Platform/Android/abi-common.cmake
+++ b/Modules/Platform/Android/abi-common.cmake
@@ -2,3 +2,18 @@
" -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 bf6b9fc..73addde 100644
--- a/Modules/Platform/Android/abi-mips-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips-Clang.cmake
@@ -1,8 +1,4 @@
# <ndk>/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 d380440..982ad46 100644
--- a/Modules/Platform/Android/abi-mips-GNU.cmake
+++ b/Modules/Platform/Android/abi-mips-GNU.cmake
@@ -1,6 +1,3 @@
# <ndk>/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 1a94107..603f1b2 100644
--- a/Modules/Platform/Android/abi-mips64-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips64-Clang.cmake
@@ -1,8 +1,4 @@
# <ndk>/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 4525d40..a1bc2c2 100644
--- a/Modules/Platform/Android/abi-mips64-GNU.cmake
+++ b/Modules/Platform/Android/abi-mips64-GNU.cmake
@@ -1,6 +1,3 @@
# <ndk>/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 f63ed36..fe7eace 100644
--- a/Modules/Platform/Android/abi-x86-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86-Clang.cmake
@@ -1,8 +1,4 @@
# <ndk>/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 c15042b..3cbcd49 100644
--- a/Modules/Platform/Android/abi-x86_64-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake
@@ -1,8 +1,4 @@
# <ndk>/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 8e562f8..061a5c2 100644
--- a/Modules/Platform/Android/ndk-stl-c++_static.cmake
+++ b/Modules/Platform/Android/ndk-stl-c++_static.cmake
@@ -3,4 +3,6 @@
__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 39374e1..b539e45 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -113,7 +113,6 @@
"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 @@
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 bb085ac..26b12a1 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -64,30 +64,6 @@
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/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index f5a0e68..5e6036d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -843,20 +843,6 @@
return convPath;
}
-std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
- const std::string& path)
-{
- cmLocalNinjaGenerator* ng =
- static_cast<cmLocalNinjaGenerator*>(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 @@
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<cmGeneratorTarget*>::const_iterator ti =
lg->GetGeneratorTargets().begin();
ti != lg->GetGeneratorTargets().end(); ++ti) {
@@ -1098,7 +1084,7 @@
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 @@
for (std::vector<cmState::Snapshot>::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<std::string, cmNinjaDeps>::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 dcf7406..2ce3c80 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -234,7 +234,6 @@
}
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 c82274a..e6a7ae6 100644
--- a/Source/cmServerDictionary.h
+++ b/Source/cmServerDictionary.h
@@ -62,6 +62,7 @@
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 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 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 a2bdf49..09b08fe 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -244,6 +244,30 @@
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 @@
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 @@
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<cmake::GeneratorInfo> 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 @@
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 39b77cd..86a9896 100644
--- a/Tests/RunCMake/Android/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Android/RunCMakeTest.cmake
@@ -174,11 +174,6 @@
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 778f2c1..1d3639d 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -45,14 +45,23 @@
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 d227753..11f467a 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 0000000..244eaa0
--- /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 0000000..6b6c6dd
--- /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 0000000..d6d6605
--- /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 0000000..2664261
--- /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 94384eb..d11431d 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -46,11 +46,11 @@
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 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/tc_handshake.json b/Tests/Server/tc_handshake.json
index 5261581..975bb3d 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"} },