Skip to content

Commit

Permalink
Added visibility compiler flag conditioning
Browse files Browse the repository at this point in the history
Visibility conditioned to specific cmake minimum version and compatible compiler id
  • Loading branch information
nicolapiccinelli authored and jschueller committed Jan 17, 2020
1 parent fc50fd7 commit 5e2d81c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/octave/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ if (Matlab_FOUND AND Matlab_MX_LIBRARY)
cmake_minimum_required (VERSION 3.3) # for the matlab_add_mex macro

matlab_add_mex (NAME nlopt_optimize-mex SRC nlopt_optimize-mex.c OUTPUT_NAME nlopt_optimize LINK_TO ${nlopt_lib})
set_target_properties(nlopt_optimize-mex PROPERTIES COMPILE_FLAGS "-fvisibility=default")
if (CMAKE_VERSION VERSION_LESS 3.14.0)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
message("Forcing mexFunction visibility to default")
set_target_properties(nlopt_optimize-mex PROPERTIES COMPILE_FLAGS "-fvisibility=default")
endif()
endif()

if (NLOPT_CXX)
set_target_properties (nlopt_optimize-mex PROPERTIES LINKER_LANGUAGE CXX)
Expand Down

0 comments on commit 5e2d81c

Please sign in to comment.