diff options
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/RunCMake/FindMatlab/MatlabTest1.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/FindMatlab/MatlabTest2.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/FindMatlab/RunCMakeTest.cmake | 11 |
4 files changed, 28 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 44a8c45..f5dd528 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -362,8 +362,16 @@ set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) # Matlab module related tests -if(CMake_TEST_FindMatlab) - add_RunCMake_test(FindMatlab) +if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_MCR OR (NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "")) + set(FindMatlab_additional_test_options ) + if(CMake_TEST_FindMatlab_MCR OR NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options -DIS_MCR=TRUE) + endif() + if(NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options ${FindMatlab_additional_test_options} "-DMCR_ROOT:FILEPATH=${CMake_TEST_FindMatlab_MCR_ROOT_DIR}") + endif() + + add_RunCMake_test(FindMatlab ${FindMatlab_additional_test_options}) endif() add_executable(pseudo_emulator pseudo_emulator.c) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake index 1cbc1c2..b4cc741 100644 --- a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake +++ b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake @@ -3,6 +3,9 @@ cmake_minimum_required (VERSION 2.8.12) enable_testing() project(test_should_fail) +if(NOT "${matlab_root}" STREQUAL "") + set(Matlab_ROOT_DIR ${matlab_root}) +endif() find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY) matlab_add_mex( diff --git a/Tests/RunCMake/FindMatlab/MatlabTest2.cmake b/Tests/RunCMake/FindMatlab/MatlabTest2.cmake index d5b0e6d..4295d3c 100644 --- a/Tests/RunCMake/FindMatlab/MatlabTest2.cmake +++ b/Tests/RunCMake/FindMatlab/MatlabTest2.cmake @@ -6,4 +6,8 @@ if(NOT DEFINED matlab_required) set(matlab_required REQUIRED) endif() +if(NOT DEFINED Matlab_ROOT_DIR AND NOT "${matlab_root}" STREQUAL "") + set(Matlab_ROOT_DIR ${matlab_root}) +endif() + find_package(Matlab ${matlab_required} COMPONENTS MX_LIBRARY) diff --git a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake index f0eb6b4..deebf89 100644 --- a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) + + +if(NOT "${MCR_ROOT}" STREQUAL "") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() + set(RunCMake_TEST_OPTIONS "-Dmatlab_root=${MCR_ROOT}") +endif() run_cmake(MatlabTest1) if(RunCMake_GENERATOR MATCHES "Make" AND UNIX) @@ -11,6 +19,9 @@ if(RunCMake_GENERATOR MATCHES "Make" AND UNIX) message(STATUS "RerunFindMatlab: first configuration to extract real Matlab_ROOT_DIR") set(RunCMake_TEST_OPTIONS "-Dmatlab_required=REQUIRED") + if(NOT "${MCR_ROOT}" STREQUAL "") + set(RunCMake_TEST_OPTIONS ${RunCMake_TEST_OPTIONS} "-Dmatlab_root=${MCR_ROOT}") + endif() run_cmake(MatlabTest2) message(STATUS "RerunFindMatlab: flushing the variables") |