-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
30 lines (20 loc) · 1.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cmake_minimum_required (VERSION 3.1) # 3.1 adds C_STANDARD, target_compile_features
project (libsh LANGUAGES C)
include (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
set (CMAKE_REQUIRED_LIBRARIES -lcurl)
# _POSIX_C_SOURCE, because I want to get all POSIX functions
# _GNU_SOURCE, т. к. я хочу получить splice и другие функции
set (CMAKE_REQUIRED_DEFINITIONS "-D_POSIX_C_SOURCE=200809L" "-D_GNU_SOURCE=1")
check_symbol_exists (sigsetjmp "setjmp.h" SH_HAVE_sigsetjmp)
include (funcs.cmake)
configure_file (ex.h.in "${PROJECT_BINARY_DIR}/ex.h")
configure_file (funcs.h.in "${PROJECT_BINARY_DIR}/funcs.h")
include_directories ("${PROJECT_BINARY_DIR}")
add_library (sh SHARED ex.c funcs.c etc.c)
set_property (TARGET sh PROPERTY C_STANDARD 11) # Because we want noreturn. Cmake can fail back to C99 or C89
target_link_libraries (sh -lcurl)
# I have to comment this, because cmake 3.1.0 doesn't know that Visual Studio 2013 supports variadic macros
# target_compile_features(sh PUBLIC c_variadic_macros)
install (TARGETS sh DESTINATION lib)
install (FILES "${PROJECT_BINARY_DIR}/ex.h" "${PROJECT_BINARY_DIR}/funcs.h" etc.h cxx.hpp DESTINATION include/libsh)
install (FILES libsh.h DESTINATION include)