generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
82 lines (68 loc) · 2.33 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
cmake_minimum_required(VERSION 3.14)
project(iso15118
VERSION 0.5.0
DESCRIPTION "iso15118 library suite"
LANGUAGES CXX C
)
find_package(everest-cmake 0.5
PATHS ../everest-cmake
)
find_package(OpenSSL 3 REQUIRED)
if (NOT everest-cmake_FOUND)
message(STATUS "Retrieving everest-cmake using FetchContent")
include(FetchContent)
FetchContent_Declare(
everest-cmake
GIT_REPOSITORY https://github.com/EVerest/everest-cmake.git
GIT_TAG v0.5.0
)
FetchContent_MakeAvailable(everest-cmake)
set(everest-cmake_DIR "${everest-cmake_SOURCE_DIR}")
include("${everest-cmake_SOURCE_DIR}/everest-cmake-config.cmake")
endif()
# options
option(${PROJECT_NAME}_BUILD_TESTING "Build unit tests, used if included as dependency" OFF)
option(BUILD_TESTING "Build unit tests, used if standalone project" OFF)
option(OPT_AUTODOWNLOAD_ISO20_SCHEMAS "\
Automatically download ISO15118-20 schemas. Note: by setting this option to \
true and hence downloading the schema files, YOU accept the ISO Customer \
Licence Agreement (“Licence Agreement”), clauses 1. ISO’s Copyright, \
7. Termination, 8. Limitations, and 9. Governing Law." OFF)
option(ISO15118_INSTALL "Enable install target" ${EVC_MAIN_PROJECT})
# list of compile options
set(ISO15118_COMPILE_OPTIONS_WARNING "-Wall;-Wextra;-Wno-unused-function;-Werror" CACHE STRING "A list of compile options used")
message(STATUS "Building libiso15118 with the following compile options: ${ISO15118_COMPILE_OPTIONS_WARNING}")
if((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} OR ${PROJECT_NAME}_BUILD_TESTING) AND BUILD_TESTING)
set(ISO15118_BUILD_TESTING ON)
endif()
# dependencies
if (NOT DISABLE_EDM)
evc_setup_edm()
# In EDM mode, we can't install exports (because the dependencies usually do not install their exports)
set(ISO15118_INSTALL OFF)
else()
find_package(cbv2g REQUIRED)
endif()
add_subdirectory(input)
add_subdirectory(src)
if (ISO15118_BUILD_TESTING)
include(CTest)
add_subdirectory(test)
endif()
if (ISO15118_INSTALL)
install(
TARGETS
iso15118
EXPORT iso15118-targets
)
install(
DIRECTORY include/
TYPE INCLUDE
PATTERN "detail" EXCLUDE
)
evc_setup_package(
NAME iso15118
EXPORT iso15118-targets
NAMESPACE iso15118
)
endif()