This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
forked from sogno-platform/libcimpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (90 loc) · 3.64 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.5)
project(libcimpp CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
add_subdirectory(doc)
add_subdirectory(thirdparty)
set(libcimpp_MAJOR_VERSION 2)
set(libcimpp_MINOR_VERSION 1)
set(libcimpp_PATCH_VERSION 0)
set(libcimpp_VERSION ${libcimpp_MAJOR_VERSION}.${libcimpp_MINOR_VERSION}.${libcimpp_PATCH_VERSION})
# Options
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option (BUILD_EXAMPLES "Build examples" OFF)
if(NOT USE_CIM_VERSION)
set(USE_CIM_VERSION "CGMES_2.4.15_27JAN2020" CACHE STRING "Define CIM Version")
endif()
message(STATUS "Building ${PROJECT_NAME} with USE_CIM_VERSION=${USE_CIM_VERSION}")
if(USE_CIM_VERSION STREQUAL "CGMES_2.4.15_27JAN2020")
set(CIM_FOLDER ${USE_CIM_VERSION})
set(CGMES_BUILD ON)
set(CIM_NAME "CGMES 2_4_15 27_01_2020")
elseif(USE_CIM_VERSION STREQUAL "CGMES_2.4.15_16FEB2016")
set(CIM_FOLDER ${USE_CIM_VERSION})
set(CGMES_BUILD ON)
set(CIM_NAME "CGMES 2_4_15 16_02_2016")
elseif(USE_CIM_VERSION STREQUAL "CGMES_2.4.13_18DEC2013")
set(CIM_FOLDER ${USE_CIM_VERSION})
set(CGMES_BUILD ON)
set(CIM_NAME "CGMES 2_4_13 18_12_2013")
elseif(USE_CIM_VERSION STREQUAL "IEC61970_17v07")
set(CIM_FOLDER "17v07")
set(CIM_NAME "IEC61970 17v07")
elseif(USE_CIM_VERSION STREQUAL "IEC61970_17v23")
set(CIM_FOLDER "17v23")
set(CIM_NAME "IEC61970 17v23")
elseif(USE_CIM_VERSION STREQUAL "IEC61970_17v23_IEC61968_13v11")
set(CIM_FOLDER "17v23_13v11")
set(CIM_NAME "IEC61970 17v23 - IEC61968 13v11")
elseif(USE_CIM_VERSION STREQUAL "IEC61970_16v29a")
set(CIM_FOLDER "16v29a")
set(CIM_NAME "IEC61970 16v29a")
elseif(USE_CIM_VERSION STREQUAL "IEC61970_16v29a_IEC61968_12v08")
set(CIM_FOLDER "16v29a_12v08")
set(CIM_NAME "IEC61970 16v29a - IEC61968 12v08")
else()
message(FATAL_ERROR "${USE_CIM_VERSION} is an invalid value for USE_CIM_VERSION")
endif()
# Uncomment this if you are developing on CIMgen and want to generate CIM c++
#if(CGMES_BUILD)
# set(CGMES_OUTPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/${CIM_FOLDER})
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/CGMES_2.4.15/generate)
#endif()
file(GLOB_RECURSE SRC src/*.cpp)
file(GLOB_RECURSE CIM_SRC ${CIM_FOLDER}/*.cpp)
add_library(${PROJECT_NAME} ${SRC} ${CIM_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "cimpp${USE_CIM_VERSION}")
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${CIM_FOLDER}>)
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
target_link_libraries(${PROJECT_NAME} PUBLIC arabica)
set_property(TARGET arabica PROPERTY POSITION_INDEPENDENT_CODE ON)
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static
)
file(GLOB HEADERS "src/*.h" "src/*.hpp")
install(FILES ${HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cimpp/${CIM_FOLDER}
COMPONENT devel
)
install(DIRECTORY ${CIM_FOLDER}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cimpp
COMPONENT devel
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
# Settings for packaging
include(CIMppPackaging)
if(BUILD_EXAMPLES)
add_executable(example examples/src/main.cpp)
target_link_libraries(example libcimpp)
target_compile_features(example PUBLIC cxx_range_for)
endif()
# Show feature summary
include(FeatureSummary)
feature_summary(WHAT ALL VAR enabledFeaturesText)
message(STATUS "${enabledFeaturesText}")
message(STATUS "Building CIMpp with USE_CIM_VERSION=${USE_CIM_VERSION}")