Skip to content

Commit

Permalink
Add rpath and symbols to export
Browse files Browse the repository at this point in the history
  • Loading branch information
qubka committed Dec 26, 2024
1 parent 8fcd0bb commit c4e62ee
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,24 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${PLUGIFY_LINK_LIBRARIES} ${CMAKE_
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wshadow -Wconversion -Werror) # -Wpedantic
target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wshadow -Wconversion) # -Werror -Wpedantic
endif()

if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
endif()

if(LINUX)
set_property(TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS "-Wl,-rpath,\\\$ORIGIN/")
endif()

if(APPLE)
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/sym/exported_symbols.lds")
elseif(UNIX)
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/sym/version_script.lds")
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE
PLUGIFY_PLATFORM_WINDOWS=$<BOOL:${WIN32}>
PLUGIFY_PLATFORM_APPLE=$<BOOL:${APPLE}>
Expand Down

0 comments on commit c4e62ee

Please sign in to comment.