Adds support for linking std libraries statically.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-11-01 13:44:28 +01:00
parent 14db160890
commit e49b862da0
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 7 additions and 0 deletions

View File

@ -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")