-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
80 lines (76 loc) · 2.79 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.0.0)
project (ceutil VERSION 2.1.3)
# version 1.0.0 Added DES, SHA, RSA
# version 2.0.0 Replace wxAppConsole with wxEvtHandler, add TCP server, header only
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "Project dir = ${PROJECT_SOURCE_DIR}")
message(STATUS "Project version = ${CMAKE_PROJECT_VERSION}")
set(ADDCV YES)
if(WIN32)
# For windows -------------------------------------------------------
# Set VCPKG_ROOT environmental variable for vcpkg root folder
message(STATUS "vcpkg dir = $ENV{VCPKG_ROOT}")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
# if 32 bits
message(STATUS "Generator x86-windows")
include_directories($ENV{VCPKG_ROOT}/installed/x86-windows/include)
link_directories($ENV{VCPKG_ROOT}/installed/x86-windows/lib)
else()
# if 64 bits
message(STATUS "Generator x64-windows")
include_directories($ENV{VCPKG_ROOT}/installed/x64-windows/include)
link_directories($ENV{VCPKG_ROOT}/installed/x64-windows/lib)
endif()
find_package(jsoncpp REQUIRED)
set(JSONCPP_LIBRARIES jsoncpp)
find_package(wxWidgets COMPONENTS core net base REQUIRED)
if(ADDCV)
find_package(OpenCV REQUIRED)
endif()
find_package(OpenSSL REQUIRED)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
# For linux -------------------------------------------------------
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP jsoncpp)
link_libraries(${JSONCPP_LIBRARIES})
include_directories(${JSONCPP_INCLUDE_DIRS})
find_package(wxWidgets COMPONENTS core net base REQUIRED)
include("${wxWidgets_USE_FILE}")
if(ADDCV)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIR})
endif()
find_package(OpenSSL REQUIRED)
endif()
# ------------------------------------------------------------------
set(LIBS
${JSONCPP_LIBRARIES}
${wxWidgets_LIBRARIES}
OpenSSL::SSL OpenSSL::Crypto
)
if(ADDCV)
set(LIBS ${LIBS} ${OpenCV_LIBS})
endif()
message(STATUS "List of libraries = ${LIBS}")
include_directories(${PROJECT_SOURCE_DIR}/include)
# add_library(${PROJECT_NAME}
# )
# target_link_libraries(${PROJECT_NAME} ${LIBS})
# install(TARGETS ${PROJECT_NAME} DESTINATION lib)
add_subdirectory(examples/I2C)
add_subdirectory(examples/kbhit)
add_subdirectory(examples/Log)
add_subdirectory(examples/Modbus)
# add_subdirectory(examples/rsakeygen)
add_subdirectory(examples/Serial)
add_subdirectory(examples/tcpclient)
add_subdirectory(examples/tcpsvr)
add_subdirectory(examples/UDP)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ce
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
)