This repository was archived by the owner on Mar 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
57 lines (46 loc) · 1.9 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
################ CMake #######################
cmake_minimum_required(VERSION 3.7.2[...3.13.4])
project(retiBTC)
#set gcc flags and requirements
if(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
set(CMAKE_C_COMPILER gcc-8)
endif()
message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}")
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -o3 -g -pthread")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
#set project folder
set(RETIBTC ${CMAKE_SOURCE_DIR}/retibtc)
#set libraries folder
link_directories(${RETIBTC}/lib)
set(LIBRARY_OUTPUT_PATH ${RETIBTC}/lib/static)
#set use of system style include (e.g. #include <libs.h>)
include_directories(SYSTEM ${RETIBTC}/include)
#set output executable
set(CMAKE_BINARY_DIR ${RETIBTC}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
#search and set OpenSSL libs even if Darwin arch
find_package(OpenSSL REQUIRED)
if( OpenSSL_FOUND )
set(OPENSSL_USE_STATIC_LIBS TRUE)
if(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
set(OPENSSL_LIBRARIES /usr/local/opt/openssl/lib)
set(OPENSSL_INCLUDE_DIR /usr/local/opt/openssl/include)
include_directories(SYSTEM /usr/local/opt/openssl/include)
endif()
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
message(STATUS "OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OpenSSL libraries: ${OPENSSL_LIBRARIES}")
endif()
#add all files in lib/ as libraries
AUX_SOURCE_DIRECTORY(${RETIBTC}/lib LIBS_FILES)
add_library(libraries ${LIBS_FILES})
#link libraries to executable
set(N_NODE_LIBS ${RETIBTC}/src/n_node/node_handler.c)
add_executable(n_node ${RETIBTC}/src/n_node/main.c ${N_NODE_LIBS})
target_link_libraries(n_node libraries OpenSSL::SSL)
set(WALLET_LIBS ${RETIBTC}/src/w_node/w_node.c)
add_executable(w_node ${RETIBTC}/src/w_node/main.c ${WALLET_LIBS})
target_link_libraries(w_node libraries OpenSSL::SSL)
#target_link_libraries(peer libraries OpenSSL::SSL)