mirror of
https://github.com/kakwa/uts-server
synced 2025-01-09 21:24:29 +01:00
adding a switch to link against glibc/dl for static compilation
This commit is contained in:
parent
18123ab448
commit
4abe7a0f3d
@ -9,6 +9,7 @@ option(DEBUG "compile with debug symbol" OFF)
|
|||||||
option(BUNDLE_CIVETWEB "bundle civetweb with uts-server" OFF)
|
option(BUNDLE_CIVETWEB "bundle civetweb with uts-server" OFF)
|
||||||
|
|
||||||
option(STATIC "static linked binary" OFF)
|
option(STATIC "static linked binary" OFF)
|
||||||
|
option(LINKDL "dynamicaly link dl" OFF)
|
||||||
|
|
||||||
IF(STATIC)
|
IF(STATIC)
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
@ -19,6 +20,10 @@ IF(STATIC)
|
|||||||
set(CIVETWEB_USE_STATIC_LIBS ON)
|
set(CIVETWEB_USE_STATIC_LIBS ON)
|
||||||
ENDIF(STATIC)
|
ENDIF(STATIC)
|
||||||
|
|
||||||
|
IF(LINK_DL)
|
||||||
|
set(DL_LIBRARIES 'dl')
|
||||||
|
ENDIF(LINK_DL)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700")
|
||||||
|
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
@ -98,6 +103,7 @@ target_link_libraries(uts-server
|
|||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
${LIBCIVETWEB_LIBRARIES}
|
${LIBCIVETWEB_LIBRARIES}
|
||||||
${ARGP_LIBRARIES}
|
${ARGP_LIBRARIES}
|
||||||
|
${DL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(TARGETS uts-server
|
INSTALL(TARGETS uts-server
|
||||||
|
@ -40,3 +40,9 @@ uts-server is compiled using cmake:
|
|||||||
# Compile statically
|
# Compile statically
|
||||||
$ cmake . -DSTATIC=ON
|
$ cmake . -DSTATIC=ON
|
||||||
$ make
|
$ 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
|
||||||
|
$ make
|
||||||
|
Loading…
x
Reference in New Issue
Block a user