-
Notifications
You must be signed in to change notification settings - Fork 159
/
ifopt-config.cmake
63 lines (56 loc) · 2 KB
/
ifopt-config.cmake
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
# ifopt-config.cmake
# ---------
#
# Locates the optimization interface ifopt.
# Copyright (c) 2018, Alexander W. Winkler. All rights reserved.
#
#
# Imported targets
# ^^^^^^^^^^^^^^^^
#
# This module defines the following IMPORTED targets:
# ifopt::ifopt_core - formulate a solver-independent optimization problem
# (ifopt::ifopt_ipopt - interface to NLP solver IPOPT)
# (ifopt::ifopt_snopt - interface to NLP solver SNOPT)
#
#
# Example usage
# ^^^^^^^^^^^^^
#
# find_package(ifopt REQUIRED)
# add_executable(foo my_problem_solved_with_IPOPT.cc)
# target_link_libraries(foo PUBLIC ifopt::ifopt_ipopt)
#
#
# Result variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project.
# These can be neccessary when building with catkin and not modern cmake
# ifopt_INCLUDE_DIRS - path to public include (.h) files
# ifopt_LIBRARIES - path to all libraries
# ifopt_LIB_CORE - path to ifopt_core library
# (ifopt_LIB_IPOPT - path to ifopt_ipopt library)
# (ifopt_LIB_SNOPT - path to ifopt_snopt library)
#
#=============================================================================
include(CMakeFindDependencyMacro)
find_dependency(Eigen3)
# these are autogenerate by cmake
include("${CMAKE_CURRENT_LIST_DIR}/ifopt_core-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ifopt_ipopt-targets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/ifopt_snopt-targets.cmake" OPTIONAL)
get_target_property(ifopt_INCLUDE_DIRS ifopt::ifopt_core INTERFACE_INCLUDE_DIRECTORIES)
# ifopt_core
get_property(ifopt_LIB_CORE TARGET ifopt::ifopt_core PROPERTY LOCATION)
list(APPEND ifopt_LIBRARIES ${ifopt_LIB_CORE})
# ifopt_ipopt
if(TARGET ifopt::ifopt_ipopt)
get_property(ifopt_LIB_IPOPT TARGET ifopt::ifopt_ipopt PROPERTY LOCATION)
list(APPEND ifopt_LIBRARIES ${ifopt_LIB_IPOPT})
endif()
# ifopt_snopt
if(TARGET ifopt::ifopt_snopt)
get_property(ifopt_LIB_SNOPT TARGET ifopt::ifopt_snopt PROPERTY LOCATION)
list(APPEND ifopt_LIBRARIES ${ifopt_LIB_SNOPT})
endif()