forked from ethz-adrl/ifopt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (50 loc) · 2.02 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
# Copyright (c) 2017, Alexander W. Winkler, ETH Zurich. All rights reserved.
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(ifopt VERSION 2.0.6)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
###########
## Build ##
###########
include(GNUInstallDirs) # for correct library locations across platforms
set(config_package_location "share/${PROJECT_NAME}/cmake") # for .cmake find-scripts installs
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # so installed solver libraries link to IFOPT/SNOPT
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) # so installed solver libraries link to libifopt_core.so
set(IFOPT_INSTALL_BINDIR ${CMAKE_INSTALL_LIBDIR}/ifopt) # replicate default for catkin installs
IF(NOT CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "CMAKE_BUILD_TYPE not set to Release -> impacts performance")
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
enable_testing()
set(LIB_CORE ifopt_core)
add_subdirectory(ifopt_core)
option(BUILD_IPOPT "compile with IPOPT solver" ON)
if (BUILD_IPOPT)
add_subdirectory(ifopt_ipopt)
endif()
option(BUILD_SNOPT "compile with SNOPT solver" OFF)
if (BUILD_SNOPT)
add_subdirectory(ifopt_snopt)
endif()
##################################################
## Install find scripts for find_package(ifopt) ##
##################################################
# generate the file IfoptConfigVersion.cmake
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ifopt-config-version.cmake"
VERSION ${ifopt_VERSION}
COMPATIBILITY SameMajorVersion
)
# install the two files in a place where cmake looks for them
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/ifopt-config.cmake" # self-written
"${CMAKE_CURRENT_BINARY_DIR}/ifopt-config-version.cmake" # generated
DESTINATION ${config_package_location}
)
# Install a Catkin 'package.xml' file. This is required by REP-136.
install(FILES package.xml DESTINATION share/${PROJECT_NAME})