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 13, 2024
1 parent 2a2374d commit dcd0412
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 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 @@ -62,7 +61,10 @@ 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)

if (UNIX)
target_link_options(${PROJECT_NAME} PRIVATE -stdlib=libc++)
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libc++ -static-libc++abi -static-libunwind)
endif ()

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

0 comments on commit dcd0412

Please sign in to comment.