Skip to content

Commit

Permalink
feat: static link to libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Mar 14, 2024
1 parent 2a2374d commit d32ffed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ elseif (UNIX)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Clang is required on Linux.")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else ()
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} (${CMAKE_SYSTEM_PROCESSOR}) is not supported")
endif ()
Expand Down Expand Up @@ -61,8 +60,11 @@ target_link_libraries(endstone_headers INTERFACE fmt::fmt)
# ===============
add_library(${PROJECT_NAME} SHARED src/example_plugin.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_link_libraries(${PROJECT_NAME} PRIVATE endstone::headers)

target_link_libraries(${PROJECT_NAME} PUBLIC endstone::headers)
if (UNIX)
target_link_options(${PROJECT_NAME} PRIVATE -stdlib=libc++ -static-libstdc++ -static-libgcc)
target_link_libraries(${PROJECT_NAME} PRIVATE libc++.a libc++abi.a libunwind.a)
endif ()

# ===============
# Install
Expand Down

0 comments on commit d32ffed

Please sign in to comment.