forked from yan9a/ceutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeM1.txt
62 lines (59 loc) · 2.2 KB
/
CMakeM1.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
# CMakeM1 checks ADDCV variable whether to include OpenCV
# together with ceutil, wxWidgets, and jsoncpp
# and return LIBS variable with the list of libraries to link
# and also set WIN32OPT variable with WIN32 for Windows
message(STATUS "Project dir = ${PROJECT_SOURCE_DIR}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "Project version = ${CMAKE_PROJECT_VERSION}")
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)
set(WIN32OPT WIN32)
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
ceutil
${JSONCPP_LIBRARIES}
${wxWidgets_LIBRARIES}
OpenSSL::SSL OpenSSL::Crypto
)
if(ADDCV)
set(LIBS ${LIBS} ${OpenCV_LIBS})
endif()
message(STATUS "LIBS = ${LIBS}")
message(STATUS "WIN32OPT = ${WIN32OPT}")