diff options
author | Itamar <itamar8910@gmail.com> | 2020-11-20 14:18:53 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-14 23:05:53 +0100 |
commit | 0220b5361eadf50b536c7e1ed46a4393817d4ad7 (patch) | |
tree | 4a1ccfa6b964c9ea770300554591bcc276b67cfc | |
parent | d89858f42ab78aee60842bc3c71f09d4594572d1 (diff) | |
download | serenity-0220b5361eadf50b536c7e1ed46a4393817d4ad7.zip |
LibC: Also build a static version of libc
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rw-r--r-- | Libraries/LibC/CMakeLists.txt | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aa600954c..6ea5d54de3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,16 @@ function(serenity_libc target_name fs_name) serenity_generated_sources(${target_name}) endfunction() +function(serenity_libc_static target_name fs_name) + serenity_install_headers("") + serenity_install_sources("Libraries/LibC") + add_library(${target_name} ${SOURCES}) + install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib) + set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name}) + target_link_directories(${target_name} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + serenity_generated_sources(${target_name}) +endfunction() + function(serenity_bin target_name) add_executable(${target_name} ${SOURCES}) target_sources(${target_name} PRIVATE ${CMAKE_SOURCE_DIR}/Libraries/LibC/crt0_shared.cpp) diff --git a/Libraries/LibC/CMakeLists.txt b/Libraries/LibC/CMakeLists.txt index 0078b058e3..b8bc5ec760 100644 --- a/Libraries/LibC/CMakeLists.txt +++ b/Libraries/LibC/CMakeLists.txt @@ -66,6 +66,11 @@ add_custom_command( ) set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES}) + +serenity_libc_static(LibCStatic c) +target_link_libraries(LibCStatic crt0) +add_dependencies(LibCStatic LibM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") serenity_libc(LibC c) target_link_libraries(LibC crt0) |