-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
63 lines (55 loc) · 3.19 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
cmake_minimum_required (VERSION 3.5.1)
project (IBEX_MYPLUGIN VERSION 0.42 LANGUAGES CXX)
set (IBEX_MYPLUGIN_DESCRIPTION "H_infinity Control synthesis using global optimization")
set (IBEX_MYPLUGIN_URL "https://github.com/ibex-team/ibex-Hcontrol/")
set (IBEX_MIN_VERSION_REQ 2.8.9.1)
# If IBEX_DIR was given on the command-line and not in the environment, set it
# as an environment variable. Enable the usage of 'cmake -DIBEX_DIR=<path> ...'
if (NOT DEFINED ENV{IBEX_DIR} AND DEFINED IBEX_DIR)
set (ENV{IBEX_DIR} "${IBEX_DIR}")
endif ()
find_package (IBEX ${IBEX_MIN_VERSION_REQ} REQUIRED)
message (STATUS "Found Ibex version ${IBEX_VERSION}")
ibex_init_common () # Ibex should have installed this function
set (CMAKE_INSTALL_CONFIGCMAKE "share/ibex_Hcontrol/cmake")
# Interval and linear programming names and versions are available
message (STATUS "Ibex was compiled with interval library "
"${IBEX_INTERVAL_LIB_NAME} ${IBEX_INTERVAL_LIB_VERSION}")
if (IBEX_LP_LIB_NAME) # Was Ibex compiled with a linear programming library ?
message (STATUS "Ibex was compiled with Linear Programming library "
"${IBEX_LP_LIB_NAME} ${IBEX_LP_LIB_VERSION}")
else ()
message (STATUS "Ibex was compiled without any Linear Programming library")
endif ()
################################################################################
# Generate pkg-config file and install it (can be removed if no library is
# installed)
################################################################################
configure_file ("ibex-Hcontrol.pc.in" "ibex-Hcontrol.pc" @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/ibex-Hcontrol.pc
DESTINATION ${CMAKE_INSTALL_PKGCONFIG})
################################################################################
# Compile sources
################################################################################
add_subdirectory (src)
################################################################################
# Generate CMake config file (can be removed if no library is installed)
################################################################################
set (IBEX_MYPLUGIN_TARGETS_CONFIG_FILE "ibex_myplugin-targets.cmake")
install (EXPORT HcontrolExport FILE ${IBEX_HCONTROL_TARGETS_CONFIG_FILE}
NAMESPACE Ibex::
DESTINATION ${CMAKE_INSTALL_CONFIGCMAKE})
configure_file (ibex-Hcontrol-config.cmake.in ibex_Hcontrol-config.cmake @ONLY)
include (CMakePackageConfigHelpers)
set (VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/ibex_Hcontrol-config-version.cmake")
write_basic_package_version_file (${VERSION_FILE} COMPATIBILITY AnyNewerVersion)
install (FILES ${VERSION_FILE}
${CMAKE_CURRENT_BINARY_DIR}/ibex_Hcontrol-config.cmake
DESTINATION ${CMAKE_INSTALL_CONFIGCMAKE})
################################################################################
# Tests
################################################################################
# The following command assumes that the tests are in a tests/ subdirectory. So
# the tests/ subdirectory must exist and must contain a CMakeLists.txt file.
# If this is not the case, comment the next line.
ibex_add_make_target_for_ctest (check)