Skip to content

Commit

Permalink
For Visual Studio it is necessary to export the object_setup function
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Oct 8, 2024
1 parent e766adc commit 7bd4ca7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,18 @@ function(pd_add_external PD_EXTERNAL_NAME EXTERNAL_SOURCES)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PD_EXTERNAL_NAME}${PD_EXTENSION}
DESTINATION ${PDLIBDIR}/${PROJECT_NAME})

if(WIN32 AND CMAKE_GENERATOR MATCHES "Visual Studio")
string(FIND ${PD_EXTERNAL_NAME} "." NAME_HAS_DOT)
string(FIND ${PD_EXTERNAL_NAME} "~" NAME_HAS_TILDE)
if(NAME_HAS_DOT EQUAL -1)
string(REPLACE "~" "_tilde" EXPORT_FUNCTION "${PD_EXTERNAL_NAME}_setup")
else()
string(REPLACE "." "0x2e" TEMP_NAME "${PD_EXTERNAL_NAMEs}")
string(REPLACE "~" "_tilde" EXPORT_FUNCTION "setup_${TEMP_NAME}")
endif()
set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "/export:${EXPORT_FUNCTION}")
endif()

endfunction(pd_add_external)

# ──────────────────────────────────────
Expand Down

0 comments on commit 7bd4ca7

Please sign in to comment.