diff options
author | Silvio Traversaro <pegua1@gmail.com> | 2022-03-13 18:23:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-21 18:58:24 (GMT) |
commit | 8468dfb35f427853f8bd3006160c0e66960f6f39 (patch) | |
tree | 1ceaa3ef47fc3744e92395c9253a89f7e930b3ac /Modules/FindMatlab.cmake | |
parent | ebb06858243c34b0e8447737c7cdad92aee6747b (diff) | |
download | CMake-8468dfb35f427853f8bd3006160c0e66960f6f39.zip CMake-8468dfb35f427853f8bd3006160c0e66960f6f39.tar.gz CMake-8468dfb35f427853f8bd3006160c0e66960f6f39.tar.bz2 |
FindMatlab: Use -batch option in matlab_add_unit_test if possible
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r-- | Modules/FindMatlab.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index d875677..81bc473 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -968,6 +968,16 @@ function(matlab_add_unit_test) message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty") endif() + # The option to run a batch program with MATLAB changes depending on the MATLAB version + # For MATLAB before R2019a (9.6), the only supported option is -r, afterwords the suggested option + # is -batch as -r is deprecated + set(maut_BATCH_OPTION "-r") + if(NOT (Matlab_VERSION_STRING STREQUAL "")) + if(Matlab_VERSION_STRING VERSION_GREATER_EQUAL "9.6") + set(maut_BATCH_OPTION "-batch") + endif() + endif() + add_test(NAME ${${prefix}_NAME} COMMAND ${CMAKE_COMMAND} "-Dtest_name=${${prefix}_NAME}" @@ -981,6 +991,7 @@ function(matlab_add_unit_test) "-Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}" "-Dcustom_Matlab_test_command=${${prefix}_CUSTOM_TEST_COMMAND}" "-Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}" + "-Dmaut_BATCH_OPTION=${maut_BATCH_OPTION}" -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake ${${prefix}_TEST_ARGS} ${${prefix}_UNPARSED_ARGUMENTS} |