forked from yan9a/ceutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (85 loc) · 3.05 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
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.0.0)
project (ceutil VERSION 1.1.0)
# version 1.1.0 Added DES, SHA, RSA
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}
${PROJECT_SOURCE_DIR}/src/ceDateTime.cpp
${PROJECT_SOURCE_DIR}/src/ceMmDateTime.cpp
${PROJECT_SOURCE_DIR}/src/ceLog.cpp
${PROJECT_SOURCE_DIR}/src/ceSerial.cpp
${PROJECT_SOURCE_DIR}/src/ceWxTmr.cpp
${PROJECT_SOURCE_DIR}/src/ceUDP.cpp
${PROJECT_SOURCE_DIR}/src/ceMisc.cpp
${PROJECT_SOURCE_DIR}/src/ceFrame.cpp
${PROJECT_SOURCE_DIR}/src/ceFraChecksum.cpp
${PROJECT_SOURCE_DIR}/src/ceFraCmd.cpp
${PROJECT_SOURCE_DIR}/src/ceI2C.cpp
${PROJECT_SOURCE_DIR}/src/cePCA9535.cpp
${PROJECT_SOURCE_DIR}/src/ceConfig.cpp
${PROJECT_SOURCE_DIR}/src/ceModbus.cpp
${PROJECT_SOURCE_DIR}/src/ceWxSerial.cpp
${PROJECT_SOURCE_DIR}/src/cewxcvMisc.cpp
${PROJECT_SOURCE_DIR}/src/ceDES.cpp
${PROJECT_SOURCE_DIR}/src/ceSHA1.cpp
${PROJECT_SOURCE_DIR}/src/ceRSA_OS.cpp
)
target_link_libraries(${PROJECT_NAME} ${LIBS})
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ce
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
)