add some dynamic optional linkage for FreeBSD on gcc_s

This commit is contained in:
kakwa 2017-01-29 17:44:45 +01:00
parent 2caed98049
commit 9c9604f495
2 changed files with 10 additions and 7 deletions

View File

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

View File

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