@@ -254,7 +254,12 @@ target_link_libraries( picode_example PRIVATE ${PROJECT_NAME} ${MATH_LIBRARY} )
254
254
set_target_properties ( picode_example PROPERTIES EXCLUDE_FROM_ALL TRUE )
255
255
256
256
# Add executable export symbols for loadable modules to prevent policy CMP0065 warning
257
- set_property (TARGET picode_example PROPERTY ENABLE_EXPORTS 1)
257
+ # Basic check for BSD based systems, like as FreeBSD, NetBSD, OpenBSD, etc.
258
+ string ( TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME_UPPER )
259
+ if (NOT CMAKE_SYSTEM_NAME_UPPER MATCHES "BSD" )
260
+ # If not a BSD system, add executable export symbols for loadable modules. Add linker flag "-Wl,--export-dynamic"
261
+ set_target_properties ( picode_example PROPERTIES ENABLE_EXPORTS TRUE )
262
+ endif ()
258
263
259
264
# If git info available adds to picode_example executable as environment var
260
265
if (DEFINED BUILD_VERSION)
@@ -272,7 +277,12 @@ target_link_libraries( cpicode_example PRIVATE c${PROJECT_NAME} ${MATH_LIBRARY}
272
277
set_target_properties ( cpicode_example PROPERTIES EXCLUDE_FROM_ALL TRUE )
273
278
274
279
# Add executable export symbols for loadable modules to prevent policy CMP0065 warning
275
- set_property (TARGET cpicode_example PROPERTY ENABLE_EXPORTS 1)
280
+ # Basic check for BSD based systems, like as FreeBSD, NetBSD, OpenBSD, etc.
281
+ string ( TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME_UPPER )
282
+ if (NOT CMAKE_SYSTEM_NAME_UPPER MATCHES "BSD" )
283
+ # If not a BSD system, add executable export symbols for loadable modules. Add linker flag "-Wl,--export-dynamic"
284
+ set_target_properties ( cpicode_example PROPERTIES ENABLE_EXPORTS TRUE )
285
+ endif ()
276
286
277
287
# If git info available adds to cpicode_example executable as environment var
278
288
if (DEFINED BUILD_VERSION)
0 commit comments