Skip to content

Commit

Permalink
Option to make a fully static binary with musl or uclibc
Browse files Browse the repository at this point in the history
We can compile FORTE with musl libc as is but need a modification
beyond this for uclibc
  • Loading branch information
kumajaya authored and azoitl committed Feb 23, 2024
1 parent 587cb0e commit c60794d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ list(JOIN link_flags " " link_flags_string)
if(FORTE_BUILD_EXECUTABLE)
ADD_EXECUTABLE (forte $<TARGET_OBJECTS:FORTE_LITE> ${SOURCE_EXECUTABLE_CPP} ${FORTE_EXECUTABLE_H})
set_target_properties(forte PROPERTIES LINK_FLAGS "${link_flags_string}")
if (MUSL OR UCLIBC)
set_target_properties(forte PROPERTIES LINK_SEARCH_START_STATIC ON)
set_target_properties(forte PROPERTIES LINK_SEARCH_END_STATIC ON)
target_link_options(forte PRIVATE -static-libgcc -static-libstdc++ -static)
endif()
target_compile_features(forte PUBLIC cxx_std_17)
TARGET_LINK_LIBRARIES (forte ${LINK_LIBRARY})
ADD_DEPENDENCIES (forte FORTE_LITE)
Expand Down

0 comments on commit c60794d

Please sign in to comment.