FindMatlab: Explicitly export mexFunction in MSVC

Fixes: #18391
This commit is contained in:
Sean Warren
2018-09-26 15:17:40 +10:00
committed by Brad King
parent 6c57f6b347
commit 9a56ed3438
2 changed files with 17 additions and 0 deletions

View File

@@ -4,3 +4,6 @@ FindMatlab-2018b
* The :module:`FindMatlab` module gained new components ``ENGINE_LIBRARY`` and
``DATAARRAY_LIBRARY`` to request finding the Matlab C++ Engine and DataArray
libraries respectively.
* The :module:`FindMatlab` module now explicitly exports mexFunction in Visual
Studio.

View File

@@ -996,6 +996,20 @@ function(matlab_add_mex)
endif() # documentation
# entry point in the mex file + taking care of visibility and symbol clashes.
if (MSVC)
get_target_property(
_previous_link_flags
${${prefix}_NAME}
LINK_FLAGS)
if(NOT _previous_link_flags)
set(_previous_link_flags)
endif()
set_target_properties(${${prefix}_NAME}
PROPERTIES
LINK_FLAGS "${_previous_link_flags} /EXPORT:mexFunction")
endif()
if(WIN32)
set_target_properties(${${prefix}_NAME}
PROPERTIES