mirror of
https://github.com/kakwa/uts-server
synced 2024-11-05 09:18:50 +01:00
more cleaning for static compilation
This commit is contained in:
parent
55dea707b9
commit
68017436dd
@ -10,11 +10,11 @@ option(STATIC "static linked binary" OFF)
|
|||||||
option(LINK_DL "dynamicaly link dl" OFF)
|
option(LINK_DL "dynamicaly link dl" OFF)
|
||||||
option(LINK_GCC_S "dynamicaly link gcc_s" OFF)
|
option(LINK_GCC_S "dynamicaly link gcc_s" OFF)
|
||||||
option(CIVETWEB_CUST_ARGS "Custom args for civetweb (if civetweb is bundled)" "")
|
option(CIVETWEB_CUST_ARGS "Custom args for civetweb (if civetweb is bundled)" "")
|
||||||
|
option(LINK_PTHREAD "dynamicaly link pthread" OFF)
|
||||||
|
|
||||||
IF(STATIC)
|
IF(STATIC)
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
set(BUILD_SHARED_LIBRARIES OFF)
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-static")
|
|
||||||
set(OPENSSL_USE_STATIC_LIBS ON)
|
set(OPENSSL_USE_STATIC_LIBS ON)
|
||||||
set(ARGP_USE_STATIC_LIBS ON)
|
set(ARGP_USE_STATIC_LIBS ON)
|
||||||
set(CIVETWEB_USE_STATIC_LIBS ON)
|
set(CIVETWEB_USE_STATIC_LIBS ON)
|
||||||
@ -28,6 +28,10 @@ IF(LINK_GCC_S)
|
|||||||
set(GCC_S_LIBRARIES 'gcc_s')
|
set(GCC_S_LIBRARIES 'gcc_s')
|
||||||
ENDIF(LINK_GCC_S)
|
ENDIF(LINK_GCC_S)
|
||||||
|
|
||||||
|
IF(LINK_PTHREAD)
|
||||||
|
set(PTHREAD_LIBRARIES 'pthread')
|
||||||
|
ENDIF(LINK_PTHREAD)
|
||||||
|
|
||||||
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)
|
||||||
@ -111,6 +115,7 @@ target_link_libraries(uts-server
|
|||||||
${ARGP_LIBRARIES}
|
${ARGP_LIBRARIES}
|
||||||
${DL_LIBRARIES}
|
${DL_LIBRARIES}
|
||||||
${GCC_S_LIBRARIES}
|
${GCC_S_LIBRARIES}
|
||||||
|
${PTHREAD_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(TARGETS uts-server
|
INSTALL(TARGETS uts-server
|
||||||
|
@ -41,9 +41,9 @@ uts-server is compiled using cmake:
|
|||||||
|
|
||||||
# Compile statically
|
# Compile statically
|
||||||
# (in some cases, it might be necessary to still
|
# (in some cases, it might be necessary to still
|
||||||
# link some libraries like dl or gcc_s, if necessary,
|
# link some libraries like dl or gcc_s or pthread, if necessary,
|
||||||
# add -DDL_LINK=ON and/or -DGCC_S_LINK=ON)
|
# add -DDL_LINK=ON and/or -DGCC_S_LINK=ON -DPTHREAD_LINK=ON)
|
||||||
$ cmake . -DSTATIC=ON # -DDL_LINK=ON -DGCC_S_LINK=ON
|
$ cmake . -DSTATIC=ON # -DDL_LINK=ON -DGCC_S_LINK=ON -DPTHREAD_LINK=ON
|
||||||
$ make
|
$ make
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
Loading…
Reference in New Issue
Block a user