[Cmake-commits] CMake branch, master, updated. v3.11.0-480-g2cdefcb
Kitware Robot
kwrobot at kitware.com
Thu Apr 12 11:35:07 EDT 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via 2cdefcbe62707a82eccbc301fe34f85bb74d932a (commit)
via d59cd3b131a0c18d93fbc04f745bed990cfefa31 (commit)
via aa5bedc52b610d69242681e7c95da76dc20b1f57 (commit)
via b148d3ade0401525aa2f1896594957a79137c5a6 (commit)
via f2376a5622e11279e2548aa515eff1ccca0d3bf0 (commit)
via 580822fa67acb10ff6802248909ac602ef3eb1fe (commit)
via 65198cfd0f96d51269c748a84bafe27cf3312abd (commit)
via 68d1fc89edf395464b301a725e6e865839b8337e (commit)
via 5f4272cc06a20d1bf5da7359d803d86a77a3a723 (commit)
via 9174786008c12a2eaf6180d536f9be4c13d94cb8 (commit)
via ffb1f19191d96572a9fcae166e911a464a143a7a (commit)
via 44c916b4c831f1e81d3cc686ddb030e363b7e90b (commit)
via ff18dce5ed4a46d12e6a79954cc35ef078addcce (commit)
from 3551aede357dfc34a64d580117d18fb3c37e8ff1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2cdefcbe62707a82eccbc301fe34f85bb74d932a
commit 2cdefcbe62707a82eccbc301fe34f85bb74d932a
Merge: d59cd3b 65198cf
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:32:31 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:32:37 2018 -0400
Merge topic 'variable_watch-on-PARENT_SCOPE'
65198cfd0f variable_watch: trigger on variables set via PARENT_SCOPE
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1948
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d59cd3b131a0c18d93fbc04f745bed990cfefa31
commit d59cd3b131a0c18d93fbc04f745bed990cfefa31
Merge: aa5bedc 5f4272c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:31:37 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:31:42 2018 -0400
Merge topic 'features-msvc-2017'
5f4272cc06 Features: Record for VS 2017 through 15.6
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1903
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa5bedc52b610d69242681e7c95da76dc20b1f57
commit aa5bedc52b610d69242681e7c95da76dc20b1f57
Merge: b148d3a ff18dce
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:29:19 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:29:24 2018 -0400
Merge topic 'attr-escape'
ff18dce5ed cmVisualStudio10TargetGenerator: Properly escape attributes
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1937
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b148d3ade0401525aa2f1896594957a79137c5a6
commit b148d3ade0401525aa2f1896594957a79137c5a6
Merge: f2376a5 ffb1f19
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:27:23 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:28:31 2018 -0400
Merge topic 'FindMatlab-handle-exception'
ffb1f19191 FindMatlab: add unit tests
44c916b4c8 FindMatlab: always handle uncaught exception
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1946
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2376a5622e11279e2548aa515eff1ccca0d3bf0
commit f2376a5622e11279e2548aa515eff1ccca0d3bf0
Merge: 580822f 9174786
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:26:34 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:27:36 2018 -0400
Merge topic 'FindwxWidgets-local-var'
9174786008 FindwxWidgets: Use more private name for local variable
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1951
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=580822fa67acb10ff6802248909ac602ef3eb1fe
commit 580822fa67acb10ff6802248909ac602ef3eb1fe
Merge: 3551aed 68d1fc8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 12 15:26:25 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 12 11:26:43 2018 -0400
Merge topic 'FindImageMagick-FixForMultipleInstalls'
68d1fc89ed FindImageMagick: Find components in same locations as main package
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1917
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65198cfd0f96d51269c748a84bafe27cf3312abd
commit 65198cfd0f96d51269c748a84bafe27cf3312abd
Author: Matteo Settenvini <matteo.settenvini at here.com>
AuthorDate: Tue Apr 10 11:16:44 2018 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 11 15:02:07 2018 -0400
variable_watch: trigger on variables set via PARENT_SCOPE
Make sure that we also trigger variable watches when a variable
is set in the parent scope.
Fixes: #17827
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bbe6cc9..71ac58f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3838,7 +3838,16 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
std::ostringstream m;
m << "Cannot set \"" << var << "\": current scope has no parent.";
this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
+ return;
}
+
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ cmVariableWatch* vv = this->GetVariableWatch();
+ if (vv) {
+ vv->VariableAccessed(var, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
+ varDef, this);
+ }
+#endif
}
cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt
new file mode 100644
index 0000000..51db19c
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt
@@ -0,0 +1,2 @@
+var MODIFIED_ACCESS a
+var MODIFIED_ACCESS b
diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake
new file mode 100644
index 0000000..207798e
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake
@@ -0,0 +1,15 @@
+
+function(watch variable access value)
+ message("${variable} ${access} ${value}")
+endfunction ()
+
+# --------------
+
+variable_watch(var watch)
+set(var "a")
+
+function(f)
+ set(var "b" PARENT_SCOPE)
+endfunction(f)
+
+f()
diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
index 2fa6275..3883999 100644
--- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(ModifiedAccess)
run_cmake(NoWatcher)
run_cmake(WatchTwice)
run_cmake(ModifyWatchInCallback)
+run_cmake(RaiseInParentScope)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68d1fc89edf395464b301a725e6e865839b8337e
commit 68d1fc89edf395464b301a725e6e865839b8337e
Author: Roman Wüger <roman.wueger at gmx.at>
AuthorDate: Tue Apr 3 14:07:34 2018 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 11 11:32:09 2018 -0400
FindImageMagick: Find components in same locations as main package
Fix component include/library path if multiple versions are installed.
When searching for individual components, look only in the locations
we expect to find them that we already computed.
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 881bff1..6d94d3b 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -104,6 +104,7 @@ function(FIND_IMAGEMAGICK_API component header)
PATH_SUFFIXES
ImageMagick ImageMagick-6 ImageMagick-7
DOC "Path to the ImageMagick arch-independent include dir."
+ NO_DEFAULT_PATH
)
find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR
NAMES magick/magick-baseconfig.h
@@ -116,6 +117,7 @@ function(FIND_IMAGEMAGICK_API component header)
PATH_SUFFIXES
ImageMagick ImageMagick-6 ImageMagick-7
DOC "Path to the ImageMagick arch-specific include dir."
+ NO_DEFAULT_PATH
)
find_library(ImageMagick_${component}_LIBRARY
NAMES ${ARGN}
@@ -125,6 +127,7 @@ function(FIND_IMAGEMAGICK_API component header)
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
DOC "Path to the ImageMagick Magick++ library."
+ NO_DEFAULT_PATH
)
# old version have only indep dir
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f4272cc06a20d1bf5da7359d803d86a77a3a723
commit 5f4272cc06a20d1bf5da7359d803d86a77a3a723
Author: Daniel Filipe <supsuper at gmail.com>
AuthorDate: Fri Mar 30 01:04:00 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 11 11:27:07 2018 -0400
Features: Record for VS 2017 through 15.6
VS 15.3 has more features than we recorded in commit v3.7.0-rc1~156^2~2
(Features: Record features for VS 15 Preview 4, 2016-09-05).
While at it, update comments and simplify some cases.
diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
index 5969586..9c604f2 100644
--- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
@@ -1,15 +1,20 @@
+# Reference: https://docs.microsoft.com/en-us/cpp/visual-cpp-language-conformance
+# https://blogs.msdn.microsoft.com/vcblog/2015/06/19/c111417-features-in-vs-2015-rtm/
+# https://blogs.msdn.microsoft.com/vcblog/2013/12/02/c1114-core-language-features-in-vs-2013-and-the-nov-2013-ctp/
+# https://blogs.msdn.microsoft.com/vcblog/2011/09/12/c11-features-in-visual-c-11/
-# Reference: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
-# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
-# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
-# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx
-# http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx
-# http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
+set(_cmake_oldestSupported "_MSC_VER >= 1600")
+# VS 2017 v15.3 fixes support for incomplete decltypes
+# https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#update_153
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "_MSC_VER >= 1911")
-set(_cmake_oldestSupported "_MSC_VER >= 1600")
+set(MSVC_2017 "_MSC_VER >= 1910")
+# VS 2017 introduces support for "N3652 Extended constexpr"
+# but as of v15.6 there are still bugs in the implementation
+#set(_cmake_feature_test_cxx_relaxed_constexpr "${MSVC_2017}")
-# VS version 15 (not 2015) introduces support for aggregate initializers.
+# VS 2017 Preview introduces support for aggregate initializers.
set(_cmake_feature_test_cxx_aggregate_default_initializers "_MSC_FULL_VER >= 190024406")
# VS 2015 Update 2 introduces support for variable templates.
@@ -48,7 +53,6 @@ set(_cmake_feature_test_cxx_reference_qualified_functions "${MSVC_2015}")
# lists this as 'partial' in 2013
set(_cmake_feature_test_cxx_deleted_functions "${MSVC_2015}")
-set(MSVC_2013_v30723 "_MSC_FULL_VER >= 180030723")
# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
# Note 1. While previous version of VisualStudio said they supported these
# they silently produced bad code, and are now marked as having partial
@@ -56,7 +60,7 @@ set(MSVC_2013_v30723 "_MSC_FULL_VER >= 180030723")
# in MSVC 2015, so support the feature for that version, assuming that is true.
# The blog post also says that VS 2013 Update 3 generates an error in cases
# that previously produced bad code.
-set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2013_v30723}")
+set(_cmake_feature_test_cxx_generalized_initializers "_MSC_FULL_VER >= 180030723")
set(MSVC_2013 "_MSC_VER >= 1800")
set(_cmake_feature_test_cxx_alias_templates "${MSVC_2013}")
@@ -98,20 +102,10 @@ set(_cmake_feature_test_cxx_template_template_parameters "${MSVC_2010}")
set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}")
set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}")
-# Currently unsupported:
-# set(_cmake_feature_test_cxx_relaxed_constexpr )
-# 'NSDMIs for aggregates'
-# set(_cmake_feature_test_cxx_aggregate_default_initializers )
-
-# In theory decltype incomplete return types was added in 2012
-# but without support for decltype_auto and return type deduction this
-# feature is unusable. This remains so as of VS 2015 Preview.
-# set(_cmake_feature_test_cxx_decltype_incomplete_return_types )
-
# Unset all the variables that we don't need exposed.
# _cmake_oldestSupported is required by WriteCompilerDetectionHeader
+set(MSVC_2017)
set(MSVC_2015)
-set(MSVC_2013_v30723)
set(MSVC_2013)
set(MSVC_2012)
set(MSVC_2010)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9174786008c12a2eaf6180d536f9be4c13d94cb8
commit 9174786008c12a2eaf6180d536f9be4c13d94cb8
Author: Andrea Ranieri <ranieri at ge.issia.cnr.it>
AuthorDate: Tue Apr 10 15:34:52 2018 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 11 10:41:10 2018 -0400
FindwxWidgets: Use more private name for local variable
Avoid using a `_filename` variable that may be set by project code.
Also unset the variable name that we do use to avoid conflict.
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index af997ea..f2d6285 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -925,14 +925,16 @@ unset(_wx_lib_missing)
# Check if a specific version was requested by find_package().
if(wxWidgets_FOUND)
- find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
- dbg_msg("_filename: ${_filename}")
+ unset(_wx_filename)
+ find_file(_wx_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
+ dbg_msg("_wx_filename: ${_wx_filename}")
- if(NOT _filename)
+ if(NOT _wx_filename)
message(FATAL_ERROR "wxWidgets wx/version.h file not found in ${wxWidgets_INCLUDE_DIRS}.")
endif()
- file(READ ${_filename} _wx_version_h)
+ file(READ "${_wx_filename}" _wx_version_h)
+ unset(_wx_filename CACHE)
string(REGEX REPLACE "^(.*\n)?#define +wxMAJOR_VERSION +([0-9]+).*"
"\\2" wxWidgets_VERSION_MAJOR "${_wx_version_h}" )
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffb1f19191d96572a9fcae166e911a464a143a7a
commit ffb1f19191d96572a9fcae166e911a464a143a7a
Author: Raffi Enficiaud <raffi.enficiaud at mines-paris.org>
AuthorDate: Mon Apr 9 22:34:48 2018 +0200
Commit: Raffi Enficiaud <raffi.enficiaud at mines-paris.org>
CommitDate: Mon Apr 9 23:36:53 2018 +0200
FindMatlab: add unit tests
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1309c42..aad7cfc 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1442,6 +1442,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
+ ADD_TEST_MACRO(FindMatlab.failure_reports ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
endif()
find_package(GTK2 QUIET)
diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt
index bf54427..951fcf2 100644
--- a/Tests/FindMatlab/basic_checks/CMakeLists.txt
+++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt
@@ -24,11 +24,12 @@ matlab_add_mex(
matlab_add_unit_test(
NAME ${PROJECT_NAME}_matlabtest-1
- TIMEOUT 90
+ TIMEOUT 300
UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m
ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
)
+# timeout tests, TIMEOUT set to very short on purpose
matlab_add_unit_test(
NAME ${PROJECT_NAME}_matlabtest-2
TIMEOUT 15
@@ -41,7 +42,7 @@ set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE)
# testing the test without the unittest framework of Matlab
matlab_add_unit_test(
NAME ${PROJECT_NAME}_matlabtest-3
- TIMEOUT 30
+ TIMEOUT 300
NO_UNITTEST_FRAMEWORK
UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m
ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
@@ -49,7 +50,7 @@ matlab_add_unit_test(
matlab_add_unit_test(
NAME ${PROJECT_NAME}_matlabtest-4
- TIMEOUT 30
+ TIMEOUT 300
NO_UNITTEST_FRAMEWORK
UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m
ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
diff --git a/Tests/FindMatlab/failure_reports/CMakeLists.txt b/Tests/FindMatlab/failure_reports/CMakeLists.txt
new file mode 100644
index 0000000..1cf9613
--- /dev/null
+++ b/Tests/FindMatlab/failure_reports/CMakeLists.txt
@@ -0,0 +1,39 @@
+
+cmake_minimum_required (VERSION 2.8.12)
+enable_testing()
+project(failure_reports)
+
+# gather tests about proper failure reports
+
+set(MATLAB_FIND_DEBUG TRUE)
+
+find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAIN_PROGRAM)
+
+# main extensions for testing, same as other tests
+matlab_add_mex(
+ # target name
+ NAME cmake_matlab_test_wrapper1
+ # output name
+ OUTPUT_NAME cmake_matlab_mex1
+ SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp
+ DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt
+ )
+
+# the unit test file does not exist: the failure should be properly reported
+matlab_add_unit_test(
+ NAME ${PROJECT_NAME}_matlabtest-1
+ TIMEOUT 300
+ UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile.m
+ ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
+ )
+set_tests_properties(${PROJECT_NAME}_matlabtest-1 PROPERTIES WILL_FAIL TRUE)
+
+# without the unit test framework
+matlab_add_unit_test(
+ NAME ${PROJECT_NAME}_matlabtest-2
+ TIMEOUT 300
+ NO_UNITTEST_FRAMEWORK
+ UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile2.m
+ ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
+ )
+set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44c916b4c831f1e81d3cc686ddb030e363b7e90b
commit 44c916b4c831f1e81d3cc686ddb030e363b7e90b
Author: Clemens Buchacher <clemens.buchacher at iis.fraunhofer.de>
AuthorDate: Fri Feb 24 16:05:05 2017 +0100
Commit: Raffi Enficiaud <raffi.enficiaud at free.fr>
CommitDate: Mon Apr 9 21:42:18 2018 +0200
FindMatlab: always handle uncaught exception
If runtests('$unittest_file') throws an exception it is ignored. It is
easy to produce such an exception by passing a nonexistent file as
UNITTEST_FILE.
We already handle exceptions if the option NO_UNITTEST_FRAMEWORK is set.
Use the same method to handle exceptions thrown by runtests or by a
custom_Matlab_test_command.
Fixes #16660.
diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake
index 64d580d..fc36fc3 100644
--- a/Modules/MatlabTestsRedirect.cmake
+++ b/Modules/MatlabTestsRedirect.cmake
@@ -55,11 +55,12 @@ endif()
if(no_unittest_framework)
- set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
+ set(unittest_to_run "${unittest_file_to_run_name}")
endif()
+set(command_to_run "try, ${unittest_to_run}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
set(Matlab_SCRIPT_TO_RUN
- "addpath(${concat_string}); ${cmd_to_run_before_test}; ${unittest_to_run}"
+ "addpath(${concat_string}); ${cmd_to_run_before_test}; ${command_to_run}"
)
# if the working directory is not specified then default
# to the output_directory because the log file will go there
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff18dce5ed4a46d12e6a79954cc35ef078addcce
commit ff18dce5ed4a46d12e6a79954cc35ef078addcce
Author: Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Thu Apr 5 21:20:16 2018 -0400
Commit: Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Thu Apr 5 21:20:16 2018 -0400
cmVisualStudio10TargetGenerator: Properly escape attributes
In addition to common XML escape characters, attributes require escaping
the double quote character. A new function, cmVS10EscapeAttr is added and
used where appropriate.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1817153..c0333ff 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -139,8 +139,11 @@ inline void cmVisualStudio10TargetGenerator::WriteElemEscapeXML(
this->WriteElem(tag, cmVS10EscapeXML(val), indentLevel);
}
-static std::string cmVS10EscapeQuotes(std::string arg)
+static std::string cmVS10EscapeAttr(std::string arg)
{
+ cmSystemTools::ReplaceString(arg, "&", "&");
+ cmSystemTools::ReplaceString(arg, "<", "<");
+ cmSystemTools::ReplaceString(arg, ">", ">");
cmSystemTools::ReplaceString(arg, "\"", """);
return arg;
}
@@ -555,7 +558,8 @@ void cmVisualStudio10TargetGenerator::Generate()
"BuildCustomizations\\CUDA ",
2);
(*this->BuildFileStream)
- << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString())
+ << cmVS10EscapeAttr(
+ this->GlobalGenerator->GetPlatformToolsetCudaString())
<< ".props\" />\n";
}
if (this->GlobalGenerator->IsMasmEnabled()) {
@@ -575,7 +579,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(),
false, true, true);
std::string import = std::string("<Import Project=\"") +
- cmVS10EscapeXML(propsLocal) + "\" />\n";
+ cmVS10EscapeAttr(propsLocal) + "\" />\n";
this->WriteString(import.c_str(), 2);
}
this->WriteString("</ImportGroup>\n", 1);
@@ -597,8 +601,8 @@ void cmVisualStudio10TargetGenerator::Generate()
ConvertToWindowsSlash(props);
this->WriteString("", 2);
(*this->BuildFileStream)
- << "<Import Project=\"" << cmVS10EscapeXML(props) << "\""
- << " Condition=\"exists('" << cmVS10EscapeXML(props) << "')\""
+ << "<Import Project=\"" << cmVS10EscapeAttr(props) << "\""
+ << " Condition=\"exists('" << cmVS10EscapeAttr(props) << "')\""
<< " Label=\"LocalAppDataPlatform\" />\n";
}
}
@@ -633,7 +637,8 @@ void cmVisualStudio10TargetGenerator::Generate()
"BuildCustomizations\\CUDA ",
2);
(*this->BuildFileStream)
- << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString())
+ << cmVS10EscapeAttr(
+ this->GlobalGenerator->GetPlatformToolsetCudaString())
<< ".targets\" />\n";
}
if (this->GlobalGenerator->IsMasmEnabled()) {
@@ -645,7 +650,7 @@ void cmVisualStudio10TargetGenerator::Generate()
std::string nasmTargets =
GetCMakeFilePath("Templates/MSBuild/nasm.targets");
std::string import = "<Import Project=\"";
- import += cmVS10EscapeXML(nasmTargets) + "\" />\n";
+ import += cmVS10EscapeAttr(nasmTargets) + "\" />\n";
this->WriteString(import.c_str(), 2);
}
this->WriteString("</ImportGroup>\n", 1);
@@ -722,7 +727,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference(
std::string const& ref, std::string const& hint)
{
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(ref) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(ref) << "\">\n";
this->WriteElem("CopyLocalSatelliteAssemblies", "true", 3);
this->WriteElem("ReferenceOutputAssembly", "true", 3);
if (!hint.empty()) {
@@ -969,7 +974,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
this->WriteString("<ItemGroup>\n", 1);
for (std::string const& ri : references) {
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(ri) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(ri) << "\">\n";
this->WriteElem("IsWinMDFile", "true", 3);
this->WriteString("</Reference>\n", 2);
}
@@ -1263,15 +1268,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
cmCustomCommandGenerator ccg(command, c, lg);
std::string comment = lg->ConstructComment(ccg);
comment = cmVS10EscapeComment(comment);
- std::string script = cmVS10EscapeXML(lg->ConstructScript(ccg));
+ std::string script = lg->ConstructScript(ccg);
// input files for custom command
std::stringstream inputs;
- inputs << cmVS10EscapeXML(source->GetFullPath());
+ inputs << source->GetFullPath();
for (std::string const& d : ccg.GetDepends()) {
std::string dep;
if (lg->GetRealDependency(d, c, dep)) {
ConvertToWindowsSlash(dep);
- inputs << ";" << cmVS10EscapeXML(dep);
+ inputs << ";" << dep;
}
}
// output files for custom command
@@ -1280,19 +1285,13 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
for (std::string const& o : ccg.GetOutputs()) {
std::string out = o;
ConvertToWindowsSlash(out);
- outputs << sep << cmVS10EscapeXML(out);
+ outputs << sep << out;
sep = ";";
}
if (this->ProjectType == csproj) {
std::string name = "CustomCommand_" + c + "_" +
cmSystemTools::ComputeStringMD5(sourcePath);
- std::string inputs_s = inputs.str();
- std::string outputs_s = outputs.str();
- comment = cmVS10EscapeQuotes(comment);
- script = cmVS10EscapeQuotes(script);
- inputs_s = cmVS10EscapeQuotes(inputs_s);
- outputs_s = cmVS10EscapeQuotes(outputs_s);
- this->WriteCustomRuleCSharp(c, name, script, inputs_s, outputs_s,
+ this->WriteCustomRuleCSharp(c, name, script, inputs.str(), outputs.str(),
comment);
} else {
this->WriteCustomRuleCpp(c, script, inputs.str(), outputs.str(),
@@ -1312,17 +1311,19 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp(
this->WritePlatformConfigTag("Message", config, 3);
(*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WritePlatformConfigTag("Command", config, 3);
- (*this->BuildFileStream) << script << "</Command>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(script) << "</Command>\n";
this->WritePlatformConfigTag("AdditionalInputs", config, 3);
- (*this->BuildFileStream) << inputs;
- (*this->BuildFileStream) << ";%(AdditionalInputs)</AdditionalInputs>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(inputs);
+ (*this->BuildFileStream) << ";%(AdditionalInputs)"
+ "</AdditionalInputs>\n";
this->WritePlatformConfigTag("Outputs", config, 3);
- (*this->BuildFileStream) << outputs << "</Outputs>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(outputs) << "</Outputs>\n";
if (this->LocalGenerator->GetVersion() >
cmGlobalVisualStudioGenerator::VS10) {
// VS >= 11 let us turn off linking of custom command outputs.
this->WritePlatformConfigTag("LinkObjects", config, 3);
- (*this->BuildFileStream) << "false</LinkObjects>\n";
+ (*this->BuildFileStream) << "false"
+ "</LinkObjects>\n";
}
}
@@ -1334,16 +1335,16 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp(
this->CSharpCustomCommandNames.insert(name);
std::stringstream attributes;
attributes << "\n Name=\"" << name << "\"";
- attributes << "\n Inputs=\"" << inputs << "\"";
- attributes << "\n Outputs=\"" << outputs << "\"";
+ attributes << "\n Inputs=\"" << cmVS10EscapeAttr(inputs) << "\"";
+ attributes << "\n Outputs=\"" << cmVS10EscapeAttr(outputs) << "\"";
this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str());
if (!comment.empty()) {
this->WriteString("<Exec Command=\"", 2);
- (*this->BuildFileStream) << "echo " << cmVS10EscapeXML(comment)
+ (*this->BuildFileStream) << "echo " << cmVS10EscapeAttr(comment)
<< "\" />\n";
}
this->WriteString("<Exec Command=\"", 2);
- (*this->BuildFileStream) << script << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(script) << "\" />\n";
this->WriteString("</Target>\n", 1);
}
@@ -1456,7 +1457,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::string obj = oi->GetFullPath();
ConvertToWindowsSlash(obj);
Elem e2(e1, "EmbeddedResource");
- e2.Attr("Include", cmVS10EscapeXML(obj));
+ e2.Attr("Include", cmVS10EscapeAttr(obj));
Elem(e2).WriteElem("Filter", "Resource Files");
e2.EndElement();
}
@@ -1554,7 +1555,7 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
std::string path = this->ConvertPath(source, s.RelativePath);
ConvertToWindowsSlash(path);
Elem e2(e1, name.c_str());
- e2.Attr("Include", cmVS10EscapeXML(path));
+ e2.Attr("Include", cmVS10EscapeAttr(path));
if (!filter.empty()) {
Elem(e2).WriteElem("Filter", filter);
}
@@ -1872,7 +1873,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool,
ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
(*this->BuildFileStream) << tool << " Include=\""
- << cmVS10EscapeXML(sourceFile) << "\"";
+ << cmVS10EscapeAttr(sourceFile) << "\"";
ToolSource toolSource = { sf, forceRelative };
this->Tools[tool].push_back(toolSource);
@@ -2185,8 +2186,8 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild(
this->WriteString("", 3);
(*this->BuildFileStream)
<< "<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='"
- << cmVS10EscapeXML(this->Configurations[ci]) << "|"
- << cmVS10EscapeXML(this->Platform) << "'\">true</ExcludedFromBuild>\n";
+ << cmVS10EscapeAttr(this->Configurations[ci]) << "|"
+ << cmVS10EscapeAttr(this->Platform) << "'\">true</ExcludedFromBuild>\n";
}
}
@@ -3624,7 +3625,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
path += computeProjectFileExtension(dt, *this->Configurations.begin());
}
ConvertToWindowsSlash(path);
- (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(path) << "\">\n";
this->WriteElem("Project",
"{" + this->GlobalGenerator->GetGUID(name) + "}", 3);
this->WriteElem("Name", name, 3);
@@ -3692,7 +3693,7 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
hasWrittenItemGroup = true;
for (std::string const& ri : sdkReferences) {
this->WriteString("<SDKReference Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(ri) << "\"/>\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(ri) << "\"/>\n";
}
}
@@ -4034,7 +4035,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
std::string sourceFile = this->ConvertPath(manifestFile, false);
ConvertToWindowsSlash(sourceFile);
this->WriteString("<Xml Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n";
this->WriteElem("SubType", "Designer", 3);
this->WriteString("</Xml>\n", 2);
this->AddedFiles.push_back(sourceFile);
@@ -4044,14 +4045,14 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
false);
ConvertToWindowsSlash(smallLogo);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n";
this->AddedFiles.push_back(smallLogo);
std::string logo = this->DefaultArtifactDir + "/Logo.png";
cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
ConvertToWindowsSlash(logo);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n";
this->AddedFiles.push_back(logo);
std::string applicationIcon =
@@ -4060,7 +4061,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
applicationIcon, false);
ConvertToWindowsSlash(applicationIcon);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(applicationIcon) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(applicationIcon) << "\" />\n";
this->AddedFiles.push_back(applicationIcon);
}
@@ -4312,7 +4313,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
std::string sourceFile = this->ConvertPath(manifestFile, false);
ConvertToWindowsSlash(sourceFile);
this->WriteString("<AppxManifest Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n";
this->WriteElem("SubType", "Designer", 3);
this->WriteString("</AppxManifest>\n", 2);
this->AddedFiles.push_back(sourceFile);
@@ -4322,7 +4323,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
false);
ConvertToWindowsSlash(smallLogo);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n";
this->AddedFiles.push_back(smallLogo);
std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png";
@@ -4330,14 +4331,14 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
false);
ConvertToWindowsSlash(smallLogo44);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo44) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(smallLogo44) << "\" />\n";
this->AddedFiles.push_back(smallLogo44);
std::string logo = this->DefaultArtifactDir + "/Logo.png";
cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
ConvertToWindowsSlash(logo);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n";
this->AddedFiles.push_back(logo);
std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png";
@@ -4345,7 +4346,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
false);
ConvertToWindowsSlash(storeLogo);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(storeLogo) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(storeLogo) << "\" />\n";
this->AddedFiles.push_back(storeLogo);
std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png";
@@ -4353,14 +4354,14 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
false);
ConvertToWindowsSlash(splashScreen);
this->WriteString("<Image Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(splashScreen) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(splashScreen) << "\" />\n";
this->AddedFiles.push_back(splashScreen);
// This file has already been added to the build so don't copy it
std::string keyFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx";
ConvertToWindowsSlash(keyFile);
this->WriteString("<None Include=\"", 2);
- (*this->BuildFileStream) << cmVS10EscapeXML(keyFile) << "\" />\n";
+ (*this->BuildFileStream) << cmVS10EscapeAttr(keyFile) << "\" />\n";
}
bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
-----------------------------------------------------------------------
Summary of changes:
Modules/Compiler/MSVC-CXX-FeatureTests.cmake | 36 ++++----
Modules/FindImageMagick.cmake | 3 +
Modules/FindwxWidgets.cmake | 10 ++-
Modules/MatlabTestsRedirect.cmake | 5 +-
Source/cmMakefile.cxx | 9 ++
Source/cmVisualStudio10TargetGenerator.cxx | 95 ++++++++++----------
Tests/CMakeLists.txt | 1 +
Tests/FindMatlab/basic_checks/CMakeLists.txt | 7 +-
Tests/FindMatlab/failure_reports/CMakeLists.txt | 39 ++++++++
.../variable_watch/RaiseInParentScope-stderr.txt | 2 +
.../variable_watch/RaiseInParentScope.cmake | 15 ++++
Tests/RunCMake/variable_watch/RunCMakeTest.cmake | 1 +
12 files changed, 146 insertions(+), 77 deletions(-)
create mode 100644 Tests/FindMatlab/failure_reports/CMakeLists.txt
create mode 100644 Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt
create mode 100644 Tests/RunCMake/variable_watch/RaiseInParentScope.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list