forked from c-jimenez/open-ocpp-simu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (49 loc) · 1.77 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
#################################################################################
# OCPP charge points simulator #
#################################################################################
cmake_minimum_required(VERSION 3.13)
project(OCPPChargePointsSimulator DESCRIPTION "OCPP Charge Points simulator" VERSION 1.2.0)
# Build options
include(CMakeLists_Options.txt)
# Target toolchain definition and specific compiler flags
if(NOT DEFINED TARGET)
if (NOT MSVC)
set(TARGET "gcc")
else()
set(TARGET "msvc")
endif()
endif()
include(CMakeLists_${TARGET}.txt)
# 3rd party
add_subdirectory(3rdparty)
# Paho MQTT is mandatory
if(NOT MSVC)
find_package(eclipse-paho-mqtt-c REQUIRED)
else()
include_directories(3rdparty/eclipse-paho-mqtt-c/include)
link_directories(3rdparty/eclipse-paho-mqtt-c/lib)
find_package(OpenSSL REQUIRED COMPONENTS SSL Crypto)
endif()
# Open OCPP is mandatory
if(NOT MSVC)
find_package(PkgConfig)
pkg_search_module(PKG_OPEN_OCPP REQUIRED IMPORTED_TARGET libopen-ocpp)
set(OPENOCPP_LIB PkgConfig::PKG_OPEN_OCPP)
else()
set(OPENOCPP_INCLUDE_DIR $ENV{OPENOCPP_INCLUDE_DIR})
set(OPENOCPP_LIB_DIR $ENV{OPENOCPP_INCLUDE_DIR})
message("OPENOCPP_INCLUDE_DIR : ${OPENOCPP_INCLUDE_DIR}")
message("OPENOCPP_LIB_DIR : ${OPENOCPP_LIB_DIR}")
include_directories(${OPENOCPP_INCLUDE_DIR})
link_directories($ENV{OPENOCPP_LIB_DIR})
set(OPENOCPP_LIB open-ocpp_static.lib)
endif()
# Default output directories
if(NOT DEFINED BIN_DIR)
set(BIN_DIR ${CMAKE_SOURCE_DIR}/bin/${TARGET})
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN_DIR})
# Sources
add_subdirectory(src)