diff options
author | Nikolaj Fogh <nfogh@bkmedical.com> | 2020-12-11 13:01:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-11 16:27:35 (GMT) |
commit | bda5e2ac8f1c260fdff3b71561a2b2524bc86741 (patch) | |
tree | 57168aee6f5bb2b72cd588648a83972804a5d58c /Modules | |
parent | adc6a4c5402658b8218a591639b652604893b919 (diff) | |
download | CMake-bda5e2ac8f1c260fdff3b71561a2b2524bc86741.zip CMake-bda5e2ac8f1c260fdff3b71561a2b2524bc86741.tar.gz CMake-bda5e2ac8f1c260fdff3b71561a2b2524bc86741.tar.bz2 |
FindMatlab: Only include engine and dataarray libraries if they are found
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindMatlab.cmake | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 8b4c397..5ac0028 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1067,7 +1067,12 @@ function(matlab_add_mex) target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) if(Matlab_HAS_CPP_API) - target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY} ${Matlab_DATAARRAY_LIBRARY}) + if(Matlab_ENGINE_LIBRARY) + target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY}) + endif() + if(Matlab_DATAARRAY_LIBRARY) + target_link_libraries(${${prefix}_NAME} ${Matlab_DATAARRAY_LIBRARY}) + endif() endif() target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${${prefix}_LINK_TO}) @@ -1726,7 +1731,6 @@ if(Matlab_HAS_CPP_API) DOC "MatlabEngine Library" NO_DEFAULT_PATH ) - list(APPEND _matlab_required_variables Matlab_ENGINE_LIBRARY) if(Matlab_ENGINE_LIBRARY) set(Matlab_ENGINE_LIBRARY_FOUND TRUE) endif() @@ -1740,7 +1744,6 @@ if(Matlab_HAS_CPP_API) DOC "MatlabDataArray Library" NO_DEFAULT_PATH ) - list(APPEND _matlab_required_variables Matlab_DATAARRAY_LIBRARY) if(Matlab_DATAARRAY_LIBRARY) set(Matlab_DATAARRAY_LIBRARY_FOUND TRUE) endif() |