summaryrefslogtreecommitdiff
path: root/Modules/FindMatlab.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-26 11:11:27 +0000
committerKitware Robot <kwrobot@kitware.com>2019-06-26 07:11:34 -0400
commitc92f5f6a7325c8a6c3b07d7a36a94c474d7ea977 (patch)
tree8a5a6fa38d09329eb1cc0711420e2f8db43b87c1 /Modules/FindMatlab.cmake
parentd770b9521292a9dbb6a2d20e4779afa379b79699 (diff)
parentc2595a4958963e3cdd5276420a15a7735176c50d (diff)
downloadcmake-c92f5f6a7325c8a6c3b07d7a36a94c474d7ea977.tar.gz
Merge topic 'FindMatlab/issue-19279-mex-compilation-error-on-attribute'
c2595a4958 FindMatlab: removing spaces in compiler define Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3473
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r--Modules/FindMatlab.cmake8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index b36dbf7822..5138f2a41f 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -1057,7 +1057,7 @@ function(matlab_add_mex)
# This one is weird, it might be a bug in <mex.h> for R2018b. When compiling with
# -fvisibility=hidden, the symbol `mexFunction` cannot be exported. Reading the
# source code for <mex.h>, it seems that the preprocessor macro `MW_NEEDS_VERSION_H`
- # needs to be defined for `__attribute__ ((visibility("default")))` to be added
+ # needs to be defined for `__attribute__((visibility("default")))` to be added
# in front of the declaration of `mexFunction`. In previous versions of MATLAB this
# was not the case, there `DLL_EXPORT_SYM` needed to be defined.
# Adding `-fvisibility=hidden` to the `mex` command causes the build to fail.
@@ -1093,11 +1093,13 @@ function(matlab_add_mex)
set(_link_flags "${_link_flags} -Wl,${_export_flag_name},${_file}")
endforeach()
+ # The `mex` command doesn't add this define. It is specified here in order
+ # to export the symbol in case the client code decides to hide its symbols
set_target_properties(${${prefix}_NAME}
PROPERTIES
- DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))"
+ DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__((visibility(\"default\")))"
LINK_FLAGS "${_link_flags}"
- ) # The `mex` command doesn't add this define. Is it necessary?
+ )
endif()