File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,18 @@ if(PTOOLS_INC_DIR AND PTOOLS_SHARED_LIB)
30
30
endif ()
31
31
32
32
add_executable (example example.cc )
33
- target_link_libraries (example
34
- -Wl,--start-group -Wl,--whole-archive paddle_fluid
35
- -Wl,--no-whole-archive -Wl,--end-group
36
- ${PTOOLS_LIB} )
33
+ if (APPLE )
34
+ set (OPTIONAL_LINK_FLAGS )
35
+ if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID} " STREQUAL "AppleClang" )
36
+ set (OPTIONAL_LINK_FLAGS "-undefined dynamic_lookup" )
37
+ endif ()
38
+ target_link_libraries (example
39
+ -Wl,-force_load paddle_fluid
40
+ ${OPTIONAL_LINK_FLAGS}
41
+ ${PTOOLS_LIB} )
42
+ else ()
43
+ target_link_libraries (example
44
+ -Wl,--start-group -Wl,--whole-archive paddle_fluid
45
+ -Wl,--no-whole-archive -Wl,--end-group
46
+ ${PTOOLS_LIB} )
47
+ endif ()
You can’t perform that action at this time.
0 commit comments