mirror of
https://github.com/kakwa/uts-server
synced 2024-11-05 09:18:50 +01:00
adding code in cmake for static compilation
This commit is contained in:
parent
e711c6ed95
commit
18123ab448
@ -8,6 +8,17 @@ set(VERSION 0.1.4)
|
||||
option(DEBUG "compile with debug symbol" OFF)
|
||||
option(BUNDLE_CIVETWEB "bundle civetweb with uts-server" OFF)
|
||||
|
||||
option(STATIC "static linked binary" OFF)
|
||||
|
||||
IF(STATIC)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
set(BUILD_SHARED_LIBRARIES OFF)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static")
|
||||
set(OPENSSL_USE_STATIC_LIBS ON)
|
||||
set(ARGP_USE_STATIC_LIBS ON)
|
||||
set(CIVETWEB_USE_STATIC_LIBS ON)
|
||||
ENDIF(STATIC)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700")
|
||||
|
||||
if(DEBUG)
|
||||
|
@ -34,7 +34,11 @@ if (ARGP_IN_LIBC)
|
||||
elseif (NOT ARGP_IN_LIBC)
|
||||
unset(ARGP_IN_LIBC CACHE)
|
||||
|
||||
find_library(ARGP_LIB "argp")
|
||||
if(ARGP_USE_STATIC_LIBS)
|
||||
find_library(ARGP_LIB "libargp.a")
|
||||
else(ARGP_USE_STATIC_LIBS)
|
||||
find_library(ARGP_LIB "argp")
|
||||
endif(ARGP_USE_STATIC_LIBS)
|
||||
find_path(ARGP_INCLUDE_DIR argp.h PATH_SUFFIXES include)
|
||||
mark_as_advanced(ARGP_LIB)
|
||||
if (ARGP_LIB)
|
||||
|
@ -2,6 +2,10 @@ if (NOT LIBCIVETWEB_LIBRARIES)
|
||||
find_path(LIBCIVETWEB_INCLUDE_DIR civetweb.h ${_LIBCIVETWEB_PATHS} PATH_SUFFIXES include include/civetweb/)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBCIVETWEB_LIBRARIES)
|
||||
find_library(LIBCIVETWEB_LIBRARIES NAMES civetweb ${_LIBCIVETWEB_PATHS} PATH_SUFFIXES lib)
|
||||
if (NOT LIBCIVETWE[DB_LIBRARIES)
|
||||
if(LIBCIVETWEB_USE_STATIC_LIBS)
|
||||
find_library(LIBCIVETWEB_LIBRARIES NAMES libcivetweb.a ${_LIBCIVETWEB_PATHS} PATH_SUFFIXES lib)
|
||||
else(LIBCIVETWEB_USE_STATIC_LIBS)
|
||||
find_library(LIBCIVETWEB_LIBRARIES NAMES civetweb ${_LIBCIVETWEB_PATHS} PATH_SUFFIXES lib)
|
||||
endif(LIBCIVETWEB_USE_STATIC_LIBS)
|
||||
endif ()
|
||||
|
@ -36,3 +36,7 @@ uts-server is compiled using cmake:
|
||||
# Compile with debug flags
|
||||
$ cmake . -DDEBUG=ON
|
||||
$ make
|
||||
|
||||
# Compile statically
|
||||
$ cmake . -DSTATIC=ON
|
||||
$ make
|
||||
|
Loading…
Reference in New Issue
Block a user