Adds support for linking std libraries statically.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
14db160890
commit
e49b862da0
|
@ -7,6 +7,7 @@ add_compile_options(-Wall -Wextra -Werror)
|
|||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
option(TESTS "Whether the test executable should be build as well." OFF)
|
||||
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_link_options(-fuse-ld=lld)
|
||||
|
@ -20,6 +21,12 @@ endif ()
|
|||
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
|
||||
add_library(MalachScript SHARED ${SRC_FILES})
|
||||
|
||||
set(LINKS)
|
||||
if (STATICC)
|
||||
set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
endif(STATICC)
|
||||
target_link_libraries(MalachScript ${LINKS})
|
||||
|
||||
if (TESTS)
|
||||
# Create Test executable
|
||||
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
|
||||
|
|
Loading…
Reference in New Issue