From e701cd7211a7874696d532693a58df2a45bf9c57 Mon Sep 17 00:00:00 2001 From: kakwa Date: Sun, 29 Jan 2017 17:44:45 +0100 Subject: [PATCH] add some dynamic optional linkage for FreeBSD on gcc_s --- CMakeLists.txt | 6 ++++++ docs/install.rst | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a197c79..e0d2e9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(BUNDLE_CIVETWEB "bundle civetweb with uts-server" OFF) option(STATIC "static linked binary" OFF) option(LINKDL "dynamicaly link dl" OFF) +option(LINKDL "dynamicaly link gcc_s" OFF) IF(STATIC) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") @@ -24,6 +25,10 @@ IF(LINK_DL) set(DL_LIBRARIES 'dl') ENDIF(LINK_DL) +IF(LINK_GCC_S) + set(GCC_S_LIBRARIES 'gcc_s') +ENDIF(LINK_GCC_S) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700") if(DEBUG) @@ -104,6 +109,7 @@ target_link_libraries(uts-server ${LIBCIVETWEB_LIBRARIES} ${ARGP_LIBRARIES} ${DL_LIBRARIES} + ${GCC_S_LIBRARIES} ) INSTALL(TARGETS uts-server diff --git a/docs/install.rst b/docs/install.rst index b82ee99..ee8df17 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -38,11 +38,8 @@ uts-server is compiled using cmake: $ make # Compile statically - $ cmake . -DSTATIC=ON - $ make - - # Sometimes it might be necessary to link against glibc/dl. - # In that case, the resulting binary is only partially static, - # but it's not possible to do better than that. - $ cmake . -DSTATIC=ON -DLINK_DL=ON + # (in some cases, it might be necessary to still + # link some libraries like dl or gcc_s, if necessary, + # add -DDL_LINK=ON and/or -DGCC_S_LINK=ON) + $ cmake . -DSTATIC=ON # -DDL_LINK=ON -DGCC_S_LINK=ON $ make