summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-compile-features.7.rst2
-rw-r--r--Help/manual/cmake-server.7.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_sf/COMPILE_FLAGS.rst7
-rw-r--r--Help/release/dev/intel-compile-features-windows.rst6
-rw-r--r--Help/release/dev/src-COMPILE_FLAGS-genex.rst5
-rw-r--r--Help/release/dev/st2-env-settings.rst6
-rw-r--r--Help/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS.rst25
-rw-r--r--Modules/Compiler/Intel-C-FeatureTests.cmake9
-rw-r--r--Modules/Compiler/Intel-C.cmake3
-rw-r--r--Modules/Compiler/Intel-CXX-FeatureTests.cmake67
-rw-r--r--Modules/Compiler/Intel-CXX.cmake14
-rw-r--r--Modules/FindMatlab.cmake3
-rw-r--r--Modules/MatlabTestsRedirect.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmBuildCommand.cxx3
-rw-r--r--Source/cmCoreTryCompile.cxx10
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx2
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx40
-rw-r--r--Source/cmExtraSublimeTextGenerator.h1
-rw-r--r--Source/cmFLTKWrapUICommand.cxx4
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmFileMonitor.cxx7
-rw-r--r--Source/cmFileMonitor.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
-rw-r--r--Source/cmGlobalNinjaGenerator.h3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx19
-rw-r--r--Source/cmIncludeCommand.cxx4
-rw-r--r--Source/cmInstallCommand.cxx2
-rw-r--r--Source/cmLoadCommandCommand.cxx8
-rw-r--r--Source/cmLocalNinjaGenerator.cxx8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx16
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx19
-rw-r--r--Source/cmServerDictionary.h2
-rw-r--r--Source/cmServerProtocol.cxx173
-rw-r--r--Source/cmSetPropertyCommand.cxx2
-rw-r--r--Source/cmSourceGroupCommand.cxx2
-rw-r--r--Source/cmSubdirCommand.cxx6
-rw-r--r--Source/cmTryRunCommand.cxx5
-rw-r--r--Source/cmUseMangledMesaCommand.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx18
-rw-r--r--Source/cmWriteFileCommand.cxx2
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt1
-rw-r--r--Tests/GeneratorExpression/echo.c3
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt8
-rw-r--r--Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake2
-rw-r--r--Tests/Server/tc_handshake.json4
54 files changed, 387 insertions, 182 deletions
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 7289e61..9862d4a 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -309,4 +309,4 @@ versions specified for each:
* ``GNU``: GNU compiler versions 4.4 through 5.0.
* ``MSVC``: Microsoft Visual Studio versions 2010 through 2015.
* ``SunPro``: Oracle SolarisStudio version 12.4.
-* ``Intel``: Intel compiler versions 12.1 through 16.0 on UNIX platforms.
+* ``Intel``: Intel compiler versions 12.1 through 17.0.
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index a72af14..9520cc1 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -276,7 +276,9 @@ 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::
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index a5b1daa..93e809a 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -160,6 +160,7 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
+ /variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
/variable/CMAKE_SYSTEM_APPBUNDLE_PATH
/variable/CMAKE_SYSTEM_FRAMEWORK_PATH
diff --git a/Help/prop_sf/COMPILE_FLAGS.rst b/Help/prop_sf/COMPILE_FLAGS.rst
index 086a063..1012164 100644
--- a/Help/prop_sf/COMPILE_FLAGS.rst
+++ b/Help/prop_sf/COMPILE_FLAGS.rst
@@ -6,3 +6,10 @@ Additional flags to be added when compiling this source file.
These flags will be added to the list of compile flags when this
source file builds. Use :prop_sf:`COMPILE_DEFINITIONS` to pass
additional preprocessor definitions.
+
+Contents of ``COMPILE_FLAGS`` may use "generator expressions"
+with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. However, :generator:`Xcode`
+does not support per-config per-source settings, so expressions
+that depend on the build configuration are not allowed with that
+generator.
diff --git a/Help/release/dev/intel-compile-features-windows.rst b/Help/release/dev/intel-compile-features-windows.rst
new file mode 100644
index 0000000..6a2cdfe
--- /dev/null
+++ b/Help/release/dev/intel-compile-features-windows.rst
@@ -0,0 +1,6 @@
+intel-compile-features-windows
+------------------------------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of features supported by Intel C++ compilers versions 12.1
+ through 17.0 on UNIX and Windows platforms.
diff --git a/Help/release/dev/src-COMPILE_FLAGS-genex.rst b/Help/release/dev/src-COMPILE_FLAGS-genex.rst
new file mode 100644
index 0000000..26cd3ef
--- /dev/null
+++ b/Help/release/dev/src-COMPILE_FLAGS-genex.rst
@@ -0,0 +1,5 @@
+src-COMPILE_FLAGS-genex
+-----------------------
+
+* The :prop_sf:`COMPILE_FLAGS` source file property learned to support
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/st2-env-settings.rst b/Help/release/dev/st2-env-settings.rst
new file mode 100644
index 0000000..7b36347
--- /dev/null
+++ b/Help/release/dev/st2-env-settings.rst
@@ -0,0 +1,6 @@
+st2-env-settings
+----------------
+
+* The :generator:`Sublime Text 2` extra generator learned to place
+ environment variables in the generated ``.sublime-project``.
+ See the :variable:`CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS` variable.
diff --git a/Help/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS.rst b/Help/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS.rst
new file mode 100644
index 0000000..02c8663
--- /dev/null
+++ b/Help/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS.rst
@@ -0,0 +1,25 @@
+CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
+---------------------------------
+
+This variable contains a list of env vars as a list of tokens with the
+syntax ``var=value``.
+
+Example:
+
+.. code-block:: cmake
+
+ set(CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
+ "FOO=FOO1\;FOO2\;FOON"
+ "BAR=BAR1\;BAR2\;BARN"
+ "BAZ=BAZ1\;BAZ2\;BAZN"
+ "FOOBAR=FOOBAR1\;FOOBAR2\;FOOBARN"
+ "VALID="
+ )
+
+In case of malformed variables CMake will fail:
+
+.. code-block:: cmake
+
+ set(CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
+ "THIS_IS_NOT_VALID"
+ )
diff --git a/Modules/Compiler/Intel-C-FeatureTests.cmake b/Modules/Compiler/Intel-C-FeatureTests.cmake
index 34175c8..5d09767 100644
--- a/Modules/Compiler/Intel-C-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-C-FeatureTests.cmake
@@ -3,15 +3,11 @@
# - https://software.intel.com/en-us/articles/c99-support-in-intel-c-compiler
# - https://software.intel.com/en-us/articles/c11-support-in-intel-c-compiler
-# FIXME: Intel C feature detection works only when simulating the GNU compiler.
-if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- return()
-endif()
-
set(DETECT_C99 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(DETECT_C11 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
#static assert is only around in version 1500 update 2 and above
-set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && ${DETECT_C99}")
+set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && (${DETECT_C11} || ${DETECT_C99} && !defined(_MSC_VER))")
set(_cmake_oldestSupported "__INTEL_COMPILER >= 1110")
set(Intel_C99 "${_cmake_oldestSupported} && ${DETECT_C99}")
@@ -21,3 +17,4 @@ set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")
unset(Intel_C99)
unset(DETECT_C99)
+unset(DETECT_C11)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 61adf40..5815857 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -52,8 +52,7 @@ macro(cmake_record_c_compile_features)
endmacro()
set(_result 0)
- if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
_get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
endif()
diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
index 57a05c8..5b74fab 100644
--- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
@@ -3,11 +3,14 @@
# - 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.
-if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- return()
-endif()
+# Notes:
+# [1] Some Intel versions define some feature macros under -std=gnu++98
+# that do not work in that mode (or work with warnings):
+# - __cpp_attributes 200809
+# - __cpp_init_captures 201304
+# - __cpp_lambdas 200907
+# - __cpp_rvalue_references 200610
+# - __cpp_variadic_templates 200704
set(_cmake_feature_test_cxx_variable_templates "__cpp_variable_templates >= 201304")
set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304")
@@ -18,44 +21,50 @@ set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) ||
#if you are compiling as 98/11/14. So to properly detect C++14 with this version
#we look for the existence of __GXX_EXPERIMENTAL_CXX0X__ but not __INTEL_CXX11_MODE__
set(DETECT_BUGGY_ICC15 "((__INTEL_COMPILER == 1500) && (__INTEL_COMPILER_UPDATE == 1))")
-set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) )")
+set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) || (defined(_MSC_VER) && defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)) )")
+unset(DETECT_BUGGY_ICC15)
set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}")
set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}")
set(_cmake_feature_test_cxx_contextual_conversions "${Intel16_CXX14}")
-set(_cmake_feature_test_cxx_generic_lambdas "${Intel16_CXX14}")
+set(_cmake_feature_test_cxx_generic_lambdas "__cpp_generic_lambdas >= 201304")
set(_cmake_feature_test_cxx_digit_separators "${Intel16_CXX14}")
# This test is supposed to work in Intel 14 but the compiler has a bug
# in versions 14 and 15::
# https://software.intel.com/en-us/forums/intel-c-compiler/topic/600514
-# It also appears to fail with an internal compiler error on Intel 16.
+# It also appears to fail with an internal compiler error on Intel 16 and 17.
#set(_cmake_feature_test_cxx_generalized_initializers "${Intel16_CXX14}")
+unset(Intel16_CXX14)
-set(Intel15_CXX14 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX14}")
-set(_cmake_feature_test_cxx_decltype_auto "${Intel15_CXX14}")
-set(_cmake_feature_test_cxx_lambda_init_captures "${Intel15_CXX14}")
+set(Intel15 "__INTEL_COMPILER >= 1500")
+set(Intel15_CXX14 "${Intel15} && ${DETECT_CXX14}")
+set(_cmake_feature_test_cxx_decltype_auto "__cpp_decltype_auto >= 201304 || ${Intel15_CXX14}")
+set(_cmake_feature_test_cxx_lambda_init_captures "(__cpp_init_captures >= 201304 || ${Intel15}) && ${DETECT_CXX14}") # [1]
set(_cmake_feature_test_cxx_attribute_deprecated "${Intel15_CXX14}")
-set(_cmake_feature_test_cxx_return_type_deduction "${Intel15_CXX14}")
+set(_cmake_feature_test_cxx_return_type_deduction "__cpp_return_type_deduction >= 201304 || ${Intel15_CXX14}")
+unset(Intel15_CXX14)
+unset(Intel15)
set(Intel15_CXX11 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_alignas "${Intel15_CXX11}")
set(_cmake_feature_test_cxx_alignof "${Intel15_CXX11}")
set(_cmake_feature_test_cxx_inheriting_constructors "${Intel15_CXX11}")
-set(_cmake_feature_test_cxx_user_literals "${Intel15_CXX11}")
+set(_cmake_feature_test_cxx_user_literals "__cpp_user_defined_literals >= 200809 || ${Intel15_CXX11}")
set(_cmake_feature_test_cxx_thread_local "${Intel15_CXX11}")
+unset(Intel15_CXX11)
set(Intel14_CXX11 "${DETECT_CXX11} && (__INTEL_COMPILER > 1400 || (__INTEL_COMPILER == 1400 && __INTEL_COMPILER_UPDATE >= 2))")
# Documented as 12.0+ but in testing it only works on 14.0.2+
-set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11} && !defined(_MSC_VER)")
set(Intel14_CXX11 "__INTEL_COMPILER >= 1400 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_delegating_constructors "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_constexpr "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_constexpr "__cpp_constexpr >= 200704 || ${Intel14_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_strong_enums "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_reference_qualified_functions "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_raw_string_literals "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_unicode_literals "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "__cpp_raw_strings >= 200710 || ${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "__cpp_unicode_literals >= 200710 || ${Intel14_CXX11}")
set(_cmake_feature_test_cxx_inline_namespaces "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_unrestricted_unions "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_nonstatic_member_init "${Intel14_CXX11}")
@@ -64,29 +73,32 @@ set(_cmake_feature_test_cxx_override "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_final "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_noexcept "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${Intel14_CXX11}")
+unset(Intel14_CXX11)
set(Intel13_CXX11 "__INTEL_COMPILER >= 1300 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_explicit_conversions "${Intel13_CXX11}")
set(_cmake_feature_test_cxx_range_for "${Intel13_CXX11}")
# Cannot find Intel documentation for N2640: cxx_uniform_initialization
set(_cmake_feature_test_cxx_uniform_initialization "${Intel13_CXX11}")
+unset(Intel13_CXX11)
-set(Intel121_CXX11 "${_cmake_oldestSupported} && ${DETECT_CXX11}")
-set(_cmake_feature_test_cxx_variadic_templates "${Intel121_CXX11}")
+set(Intel121 "${_cmake_oldestSupported}")
+set(Intel121_CXX11 "${Intel121} && ${DETECT_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "(__cpp_variadic_templates >= 200704 || ${Intel121}) && ${DETECT_CXX11}") # [1]
set(_cmake_feature_test_cxx_alias_templates "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_nullptr "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_trailing_return_types "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_attributes "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_attributes "__cpp_attributes >= 200809 || ${Intel121}")
set(_cmake_feature_test_cxx_default_function_template_args "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_extended_friend_declarations "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_rvalue_references "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_decltype "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "(__cpp_rvalue_references >= 200610 || ${Intel121}) && ${DETECT_CXX11}") # [1]
+set(_cmake_feature_test_cxx_decltype "__cpp_decltype >= 200707 || ${Intel121_CXX11}")
set(_cmake_feature_test_cxx_defaulted_functions "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_deleted_functions "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_local_type_template_args "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_lambdas "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_binary_literals "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_static_assert "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "(__cpp_lambdas >= 200907 || ${Intel121}) && ${DETECT_CXX11}") # [1]
+set(_cmake_feature_test_cxx_binary_literals "__cpp_binary_literals >= 201304 || ${Intel121}")
+set(_cmake_feature_test_cxx_static_assert "(__cpp_static_assert >= 200410 || ${Intel121}) && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_right_angle_brackets "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_auto_type "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_extern_templates "${Intel121_CXX11}")
@@ -94,3 +106,8 @@ set(_cmake_feature_test_cxx_variadic_macros "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_long_long_type "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_func_identifier "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_template_template_parameters "${Intel121_CXX11}")
+unset(Intel121_CXX11)
+unset(Intel121)
+
+unset(DETECT_CXX11)
+unset(DETECT_CXX14)
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 29e02d3..b6bc2ee 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -35,11 +35,12 @@ endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=gnu++98")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98")
endif()
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=${_ext}98")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
@@ -64,16 +65,15 @@ macro(cmake_record_cxx_compile_features)
endmacro()
set(_result 0)
- if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
- _get_intel_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ _get_intel_features("${CMAKE_CXX14_STANDARD_COMPILE_OPTION}" CMAKE_CXX14_COMPILE_FEATURES)
endif()
if (_result EQUAL 0)
- _get_intel_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ _get_intel_features("${CMAKE_CXX11_STANDARD_COMPILE_OPTION}" CMAKE_CXX11_COMPILE_FEATURES)
endif()
if (_result EQUAL 0)
- _get_intel_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ _get_intel_features("${CMAKE_CXX98_STANDARD_COMPILE_OPTION}" CMAKE_CXX98_COMPILE_FEATURES)
endif()
endif()
endmacro()
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 @@ 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 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/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 195acba..69b4afd 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 7)
-set(CMake_VERSION_PATCH 20161027)
+set(CMake_VERSION_PATCH 20161101)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 04e1a0b..ecff0c3 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -44,7 +44,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
// Load all the files in the directory
cmsys::Directory dir;
- if (dir.Load(tdir.c_str())) {
+ if (dir.Load(tdir)) {
size_t numfiles = dir.GetNumberOfFiles();
for (size_t i = 0; i < numfiles; ++i) {
std::string file = dir.GetFile(static_cast<unsigned long>(i));
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index d03b8c4..6836151 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -90,8 +90,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
std::string makecommand =
this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
- target, configuration.c_str(), "",
- this->Makefile->IgnoreErrorsCMP0061());
+ target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
this->Makefile->AddDefinition(variable, makecommand.c_str());
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index a1de074..b7d2196 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -40,7 +40,7 @@ static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
bool isTryRun)
{
- this->BinaryDirectory = argv[1].c_str();
+ this->BinaryDirectory = argv[1];
this->OutputFile = "";
// which signature were we called with ?
this->SrcFileSignature = true;
@@ -149,13 +149,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
}
} else if (doing == DoingOutputVariable) {
- outputVariable = argv[i].c_str();
+ outputVariable = argv[i];
doing = DoingNone;
} else if (doing == DoingCopyFile) {
- copyFile = argv[i].c_str();
+ copyFile = argv[i];
doing = DoingNone;
} else if (doing == DoingCopyFileError) {
- copyFileError = argv[i].c_str();
+ copyFileError = argv[i];
doing = DoingNone;
} else if (doing == DoingSources) {
sources.push_back(argv[i]);
@@ -163,7 +163,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
this->SrcFileSignature = false;
projectName = argv[i].c_str();
} else if (i == 4 && !this->SrcFileSignature) {
- targetName = argv[i].c_str();
+ targetName = argv[i];
} else {
std::ostringstream m;
m << "try_compile given unknown argument \"" << argv[i] << "\".";
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index f9f5f3a..2069785 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -26,7 +26,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
std::string installDir = this->IEGen->GetDestination();
os << "LOCAL_PATH := $(call my-dir)\n";
size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/');
- numDotDot += (installDir.size() > 0) ? 1 : 0;
+ numDotDot += installDir.empty() ? 0 : 1;
std::string path;
for (size_t n = 0; n < numDotDot; n++) {
path += "/..";
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index f46019e..9ef684d 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -62,6 +62,8 @@ void cmExtraSublimeTextGenerator::Generate()
{
this->ExcludeBuildFolder = this->GlobalGenerator->GlobalSettingIsOn(
"CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE");
+ this->EnvSettings = this->GlobalGenerator->GetSafeGlobalSetting(
+ "CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS");
// for each sub project in the project create a sublime text 2 project
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
@@ -130,7 +132,37 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
// End of build_systems
fout << "\n\t]";
- fout << "\n\t}";
+ std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
+ std::vector<std::string> tokens;
+ cmSystemTools::ExpandListArgument(this->EnvSettings, tokens);
+
+ if (!this->EnvSettings.empty()) {
+ fout << ",";
+ fout << "\n\t\"env\":";
+ fout << "\n\t{";
+ fout << "\n\t\t" << systemName << ":";
+ fout << "\n\t\t{";
+ for (std::vector<std::string>::iterator i = tokens.begin();
+ i != tokens.end(); ++i) {
+ size_t const pos = i->find_first_of('=');
+
+ if (pos != std::string::npos) {
+ std::string varName = i->substr(0, pos);
+ std::string varValue = i->substr(pos + 1);
+
+ fout << "\n\t\t\t\"" << varName << "\":\"" << varValue << "\"";
+ } else {
+ std::ostringstream e;
+ e << "Could not parse Env Vars specified in "
+ "\"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS\""
+ << ", corrupted string " << *i;
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ }
+ fout << "\n\t\t}";
+ fout << "\n\t}";
+ }
+ fout << "\n}";
}
void cmExtraSublimeTextGenerator::AppendAllTargets(
@@ -341,7 +373,11 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
}
// Add source file specific flags.
- lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = source->GetProperty("COMPILE_FLAGS")) {
+ cmGeneratorExpression ge;
+ const char* processed = ge.Parse(cflags)->Evaluate(lg, config);
+ lg->AppendFlags(flags, processed);
+ }
return flags;
}
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 0c58221..a860d34 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -66,6 +66,7 @@ private:
cmGeneratorTarget* gtgt);
bool ExcludeBuildFolder;
+ std::string EnvSettings;
};
#endif
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 1f0ce8d..1e8ca06 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -82,8 +82,8 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
no_working_dir);
cmSourceFile* sf = this->Makefile->GetSource(cxxres);
- sf->AddDepend(hname.c_str());
- sf->AddDepend(origname.c_str());
+ sf->AddDepend(hname);
+ sf->AddDepend(origname);
this->GeneratedSourcesClasses.push_back(sf);
}
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 6285894..ac76191 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2600,7 +2600,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
err += *i;
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err);
}
++i;
}
@@ -2884,7 +2884,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
err += *i;
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err);
}
++i;
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index b55341b..9844306 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -247,7 +247,10 @@ public:
void StopWatching() final {}
- void AppendCallback(cmFileMonitor::Callback cb) { CbList.push_back(cb); }
+ void AppendCallback(cmFileMonitor::Callback const& cb)
+ {
+ this->CbList.push_back(cb);
+ }
std::string Path() const final
{
@@ -310,7 +313,7 @@ cmFileMonitor::~cmFileMonitor()
}
void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths,
- Callback cb)
+ Callback const& cb)
{
for (const auto& p : paths) {
std::vector<std::string> pathSegments;
diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h
index e05f48d..48169b8 100644
--- a/Source/cmFileMonitor.h
+++ b/Source/cmFileMonitor.h
@@ -17,7 +17,7 @@ public:
~cmFileMonitor();
using Callback = std::function<void(const std::string&, int, int)>;
- void MonitorPaths(const std::vector<std::string>& paths, Callback cb);
+ void MonitorPaths(const std::vector<std::string>& paths, Callback const& cb);
void StopMonitoring();
std::vector<std::string> WatchedFiles() const;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ee594b0..830ab7f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -34,6 +34,11 @@
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
const char* cmGlobalNinjaGenerator::INDENT = " ";
+#ifdef _WIN32
+std::string const cmGlobalNinjaGenerator::SHELL_NOOP = "cd .";
+#else
+std::string const cmGlobalNinjaGenerator::SHELL_NOOP = ":";
+#endif
void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
{
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 81ec3eb..064ff0b 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -58,6 +58,9 @@ public:
/// The indentation string used when generating Ninja's build file.
static const char* INDENT;
+ /// The shell command used for a no-op.
+ static std::string const SHELL_NOOP;
+
/// Write @a count times INDENT level to output stream @a os.
static void Indent(std::ostream& os, int count);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 17d49e8..90caaf9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -963,7 +963,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
(type == cmStateEnums::OBJECT_LIBRARY) ||
(type == cmStateEnums::GLOBAL_TARGET) ||
(type == cmStateEnums::UTILITY)) {
- std::string name = target->GetName();
+ std::string const& name = target->GetName();
if (emittedTargets.insert(name).second) {
path = "... ";
path += name;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 8424ded..84a8c5e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -675,7 +675,24 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
default:
break;
}
- lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = sf->GetProperty("COMPILE_FLAGS")) {
+ cmGeneratorExpression ge;
+ std::string configName = "NO-PER-CONFIG-SUPPORT-IN-XCODE";
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> compiledExpr = ge.Parse(cflags);
+ const char* processed = compiledExpr->Evaluate(lg, configName);
+ if (compiledExpr->GetHadContextSensitiveCondition()) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Xcode does not support per-config per-source COMPILE_FLAGS:\n"
+ " " << cflags << "\n"
+ "specified for source:\n"
+ " " << sf->GetFullPath() << "\n";
+ /* clang-format on */
+ lg->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ lg->AppendFlags(flags, processed);
+ }
// Add per-source definitions.
BuildObjectListOrString flagsBuild(this, false);
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 0f7799e..12e0c9a 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -69,7 +69,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
if (!mfile.empty()) {
- fname = mfile.c_str();
+ fname = mfile;
}
}
@@ -111,7 +111,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
}
std::string listFile = cmSystemTools::CollapseFullPath(
- fname.c_str(), this->Makefile->GetCurrentSourceDirectory());
+ fname, this->Makefile->GetCurrentSourceDirectory());
if (optional && !cmSystemTools::FileExists(listFile.c_str())) {
if (!resultVarName.empty()) {
this->Makefile->AddDefinition(resultVarName, "NOTFOUND");
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 7bf9462..bf59e88 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -986,7 +986,7 @@ bool cmInstallCommand::HandleDirectoryMode(
std::ostringstream e;
e << args[0] << " does not allow \"" << args[i]
<< "\" after PATTERN or REGEX.";
- this->SetError(e.str().c_str());
+ this->SetError(e.str());
return false;
}
exclude_from_all = true;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index e042b07..b6743f1 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -208,7 +208,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
}
// Try to find the program.
- std::string fullPath = cmSystemTools::FindFile(moduleName.c_str(), path);
+ std::string fullPath = cmSystemTools::FindFile(moduleName, path);
if (fullPath == "") {
std::ostringstream e;
e << "Attempt to load command failed from file \"" << moduleName << "\"";
@@ -237,14 +237,14 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
// find the init function
std::string initFuncName = args[0] + "Init";
CM_INIT_FUNCTION initFunction =
- (CM_INIT_FUNCTION)cmsys::DynamicLoader::GetSymbolAddress(
- lib, initFuncName.c_str());
+ (CM_INIT_FUNCTION)cmsys::DynamicLoader::GetSymbolAddress(lib,
+ initFuncName);
if (!initFunction) {
initFuncName = "_";
initFuncName += args[0];
initFuncName += "Init";
initFunction = (CM_INIT_FUNCTION)(
- cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName.c_str()));
+ cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName));
}
// if the symbol is found call it to set the name on the
// function blocker
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index cd9af54..c27ab09 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -299,15 +299,11 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(
std::string cmLocalNinjaGenerator::BuildCommandLine(
const std::vector<std::string>& cmdLines)
{
- // If we have no commands but we need to build a command anyway, use ":".
+ // If we have no commands but we need to build a command anyway, use noop.
// This happens when building a POST_BUILD value for link targets that
// don't use POST_BUILD.
if (cmdLines.empty()) {
-#ifdef _WIN32
- return "cd .";
-#else
- return ":";
-#endif
+ return cmGlobalNinjaGenerator::SHELL_NOOP;
}
std::ostringstream cmd;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7c32e6c..49b057b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1464,7 +1464,9 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
needfc = true;
}
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
- fc.CompileFlags = cflags;
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ fc.CompileFlags = cge->Evaluate(lg, *i);
needfc = true;
}
if (lg->FortranProject) {
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 68c166e..68aabef 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -437,8 +437,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
langFlags += "_FLAGS)";
this->LocalGenerator->AppendFlags(flags, langFlags);
- std::string configUpper =
- cmSystemTools::UpperCase(this->LocalGenerator->GetConfigName());
+ std::string config = this->LocalGenerator->GetConfigName();
+ std::string configUpper = cmSystemTools::UpperCase(config);
// Add Fortran format flags.
if (lang == "Fortran") {
@@ -446,12 +446,14 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
// Add flags from source file properties.
- if (source.GetProperty("COMPILE_FLAGS")) {
- this->LocalGenerator->AppendFlags(flags,
- source.GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = source.GetProperty("COMPILE_FLAGS")) {
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ const char* evaluatedFlags = cge->Evaluate(this->LocalGenerator, config,
+ false, this->GeneratorTarget);
+ this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
*this->FlagFileStream << "# Custom flags: " << relativeObj
- << "_FLAGS = " << source.GetProperty("COMPILE_FLAGS")
- << "\n"
+ << "_FLAGS = " << evaluatedFlags << "\n"
<< "\n";
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 11773f9..d70bf8e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -675,7 +675,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (!symlinkNeeded) {
vars["POST_BUILD"] = postBuildCmdLine;
} else {
- vars["POST_BUILD"] = ":";
+ vars["POST_BUILD"] = cmGlobalNinjaGenerator::SHELL_NOOP;
symlinkVars["POST_BUILD"] = postBuildCmdLine;
}
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b48387c..cf60892 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -132,8 +132,14 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
// Add source file specific flags.
- this->LocalGenerator->AppendFlags(flags,
- source->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = source->GetProperty("COMPILE_FLAGS")) {
+ std::string config = this->LocalGenerator->GetConfigName();
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ const char* evaluatedFlags = cge->Evaluate(this->LocalGenerator, config,
+ false, this->GeneratorTarget);
+ this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
+ }
return flags;
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 32b0a92..7a17f2c 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -180,33 +180,30 @@ protected:
while (cmSystemTools::GetLineFromStream(fin, line)) {
if (cmHasLiteralPrefix(line.c_str(), "#include")) {
// if it is an include line then create a string class
- std::string currentline = line;
- size_t qstart = currentline.find('\"', 8);
+ size_t qstart = line.find('\"', 8);
size_t qend;
// if a quote is not found look for a <
if (qstart == std::string::npos) {
- qstart = currentline.find('<', 8);
+ qstart = line.find('<', 8);
// if a < is not found then move on
if (qstart == std::string::npos) {
- cmSystemTools::Error("unknown include directive ",
- currentline.c_str());
+ cmSystemTools::Error("unknown include directive ", line.c_str());
continue;
} else {
- qend = currentline.find('>', qstart + 1);
+ qend = line.find('>', qstart + 1);
}
} else {
- qend = currentline.find('\"', qstart + 1);
+ qend = line.find('\"', qstart + 1);
}
// extract the file being included
- std::string includeFile =
- currentline.substr(qstart + 1, qend - qstart - 1);
+ std::string includeFile = line.substr(qstart + 1, qend - qstart - 1);
// see if the include matches the regular expression
if (!this->IncludeFileRegularExpression.find(includeFile)) {
if (this->Verbose) {
std::string message = "Skipping ";
message += includeFile;
message += " for file ";
- message += info->FullPath.c_str();
+ message += info->FullPath;
cmSystemTools::Error(message.c_str(), CM_NULLPTR);
}
continue;
@@ -520,7 +517,7 @@ bool cmOutputRequiredFilesCommand::InitialPass(
const cmDependInformation* info = md.FindDependencies(this->File.c_str());
if (info) {
// write them out
- FILE* fout = cmsys::SystemTools::Fopen(this->OutputFile.c_str(), "w");
+ FILE* fout = cmsys::SystemTools::Fopen(this->OutputFile, "w");
if (!fout) {
std::string err = "Can not open output file: ";
err += this->OutputFile;
diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h
index 2d64cbd..e6a7ae6 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";
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index e50878b..609ad2b 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -82,7 +82,7 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
std::vector<std::string>* tmpFiles)
{
const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/';
- const std::vector<cmMakefile*> makefiles = gg->GetMakefiles();
+ std::vector<cmMakefile*> const& makefiles = gg->GetMakefiles();
for (auto it = makefiles.begin(); it != makefiles.end(); ++it) {
const std::vector<std::string> listFiles = (*it)->GetListFiles();
@@ -249,6 +249,30 @@ std::pair<int, int> 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)
{
@@ -257,21 +281,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;
}
@@ -280,77 +303,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;
+ }
+
+ // check toolset:
+ if (!testValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset",
+ errorMessage)) {
return false;
}
- if (sourceDirectory.empty()) {
- sourceDirectory = cachedSourceDirectory;
+
+ // 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;
}
@@ -358,13 +390,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;
}
@@ -652,7 +686,12 @@ static Json::Value DumpSourceFilesList(
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string compileFlags = ld.Flags;
- lg->AppendFlags(compileFlags, file->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = file->GetProperty("COMPILE_FLAGS")) {
+ cmGeneratorExpression ge;
+ const char* processed =
+ ge.Parse(cflags)->Evaluate(target->GetLocalGenerator(), config);
+ lg->AppendFlags(compileFlags, processed);
+ }
fileData.Flags = compileFlags;
fileData.IncludePathList = ld.IncludePathList;
@@ -816,7 +855,7 @@ static Json::Value DumpTargetsList(
return result;
}
-static Json::Value DumpProjectList(const cmake* cm, const std::string config)
+static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
{
Json::Value result = Json::arrayValue;
@@ -1025,7 +1064,7 @@ cmServerResponse cmServerProtocol1_0::ProcessGlobalSettings(
}
static void setBool(const cmServerRequest& request, const std::string& key,
- std::function<void(bool)> setter)
+ std::function<void(bool)> const& setter)
{
if (request.Data[key].isNull()) {
return;
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 79221c8..60c198a 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -342,7 +342,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
return false;
}
} else if (this->PropertyName == "TYPE") {
- if (!cmState::IsCacheEntryType(this->PropertyValue.c_str())) {
+ if (!cmState::IsCacheEntryType(this->PropertyValue)) {
std::ostringstream e;
e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\"";
this->SetError(e.str());
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index ff3ec7f..3f20d4e 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -69,7 +69,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
src += "/";
src += args[i];
}
- src = cmSystemTools::CollapseFullPath(src.c_str());
+ src = cmSystemTools::CollapseFullPath(src);
sg->AddGroupFile(src);
} else {
std::ostringstream err;
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index 55761bf..3727dfa 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -31,12 +31,10 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
// if they specified a relative path then compute the full
std::string srcPath =
- std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" +
- i->c_str();
+ std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" + *i;
if (cmSystemTools::FileIsDirectory(srcPath)) {
std::string binPath =
- std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
- i->c_str();
+ std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + *i;
this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false);
}
// otherwise it is a full path
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 9457d5b..c4fc94e 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -86,8 +86,9 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder
- if (this->OutputVariable.size() && (!this->RunOutputVariable.empty() ||
- !this->CompileOutputVariable.empty())) {
+ if (!this->OutputVariable.empty() &&
+ (!this->RunOutputVariable.empty() ||
+ !this->CompileOutputVariable.empty())) {
cmSystemTools::Error(
"You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
"or RUN_OUTPUT_VARIABLE. Please use only COMPILE_OUTPUT_VARIABLE and/or "
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index ffeaa51..3e72d75 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -108,5 +108,5 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source,
fin.close();
fout.close();
cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), outFile.c_str());
- cmSystemTools::RemoveFile(tempOutputFile.c_str());
+ cmSystemTools::RemoveFile(tempOutputFile);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 22167ca..97eb3c7 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1355,8 +1355,13 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
objectName = this->GeneratorTarget->GetObjectName(&sf);
}
std::string flags;
+ bool configDependentFlags = false;
std::string defines;
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
+
+ if (cmGeneratorExpression::Find(cflags) != std::string::npos) {
+ configDependentFlags = true;
+ }
flags += cflags;
}
if (const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) {
@@ -1412,7 +1417,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
// if we have flags or defines for this config then
// use them
- if (!flags.empty() || !configDefines.empty() || compileAs || noWinRT) {
+ if (!flags.empty() || configDependentFlags || !configDefines.empty() ||
+ compileAs || noWinRT) {
(*this->BuildFileStream) << firstString;
firstString = ""; // only do firstString once
hasFlags = true;
@@ -1427,7 +1433,15 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
if (noWinRT) {
clOptions.AddFlag("CompileAsWinRT", "false");
}
- clOptions.Parse(flags.c_str());
+ if (configDependentFlags) {
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(flags);
+ std::string evaluatedFlags =
+ cge->Evaluate(this->LocalGenerator, *config);
+ clOptions.Parse(evaluatedFlags.c_str());
+ } else {
+ clOptions.Parse(flags.c_str());
+ }
if (clOptions.HasFlag("AdditionalIncludeDirectories")) {
clOptions.AppendFlag("AdditionalIncludeDirectories",
"%(AdditionalIncludeDirectories)");
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index b3ac31c..96c8e27 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -65,7 +65,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
overwrite ? std::ios::out : std::ios::app);
if (!file) {
std::string error = "Internal CMake error when trying to open file: ";
- error += fileName.c_str();
+ error += fileName;
error += " for writing.";
this->SetError(error);
return false;
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4f2f434..f0d6abf 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -257,6 +257,7 @@ add_custom_target(check-part4 ALL
# Cover test properties with generator expressions.
add_executable(echo echo.c)
add_executable(pwd pwd.c)
+set_property(SOURCE echo.c PROPERTY COMPILE_FLAGS $<1:-DSRC_GENEX_WORKS>)
add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>)
set_property(TEST echo-configuration PROPERTY
diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c
index 06b0844..41596a2 100644
--- a/Tests/GeneratorExpression/echo.c
+++ b/Tests/GeneratorExpression/echo.c
@@ -3,6 +3,9 @@
int main(int argc, char* argv[])
{
+#ifndef SRC_GENEX_WORKS
+#error SRC_GENEX_WORKS not defined
+#endif
printf("%s\n", argv[1]);
return EXIT_SUCCESS;
}
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt
new file mode 100644
index 0000000..6500649
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Error in CMakeLists.txt:
+ Xcode does not support per-config per-source COMPILE_FLAGS:
+
+ \$<\$<CONFIG:Debug>:-DMYDEBUG>
+
+ specified for source:
+
+ .*/Tests/RunCMake/XcodeProject/main.c$
diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake
new file mode 100644
index 0000000..99cec5b
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_executable(main main.c)
+set_property(SOURCE main.c PROPERTY COMPILE_FLAGS "$<$<CONFIG:Debug>:-DMYDEBUG>")
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index d43c80d..60912c2 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -13,6 +13,8 @@ if (NOT XCODE_VERSION VERSION_LESS 6)
run_cmake(XcodePlatformFrameworks)
endif()
+run_cmake(PerConfigPerSourceFlags)
+
# Use a single build tree for a few tests without cleaning.
if(NOT XCODE_VERSION VERSION_LESS 5)
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"} },