Skip to content

Commit 727a759

Browse files
fix(windows): all dynamic library target should export all symbols (estkme-group#362)
1 parent 7f26a84 commit 727a759

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

driver/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ else()
1919
add_library(euicc-drivers STATIC)
2020
endif()
2121
target_link_libraries(euicc-drivers PRIVATE euicc ${CJSON_LIBRARY} lpac-utils)
22+
23+
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
24+
if(WIN32)
25+
target_link_options(euicc-drivers PRIVATE "LINKER:--export-all-symbols")
26+
endif()
27+
2228
target_sources(
2329
euicc-drivers
2430
PRIVATE
@@ -187,6 +193,10 @@ if ((LPAC_DYNAMIC_DRIVERS AND LPAC_DYNAMIC_DRIVERS_SOLID) OR NOT LPAC_DYNAMIC_DR
187193
list(APPEND LIBEUICC_DRIVERS_REQUIRES0 ${LIBEUICC_DRIVERS_REQUIRES})
188194
else()
189195
foreach(driver ${LPAC_DRIVERS})
196+
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
197+
if(WIN32)
198+
target_link_options(${driver} PRIVATE "LINKER:--export-all-symbols")
199+
endif()
190200
install(TARGETS ${driver} LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/lpac/drivers/)
191201
endforeach()
192202
endif()

euicc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ set_target_properties(euicc PROPERTIES
7171
if(LPAC_DYNAMIC_LIBEUICC)
7272
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
7373
if(WIN32)
74-
set_target_properties(euicc PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
74+
target_link_options(euicc PRIVATE "LINKER:--export-all-symbols")
7575
endif()
7676
# Install a pkg-config file
7777
configure_file(libeuicc.pc.in libeuicc.pc @ONLY)

utils/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ else()
66
endif()
77
target_link_libraries(lpac-utils PRIVATE ${CJSON_LIBRARY} euicc)
88
target_compile_options(lpac-utils PRIVATE -Wall -Wextra)
9+
10+
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
11+
if(WIN32)
12+
target_link_options(lpac-utils PRIVATE "LINKER:--export-all-symbols")
13+
endif()
14+
915
target_sources(
1016
lpac-utils
1117
PUBLIC

0 commit comments

Comments
 (0)