Skip to content
Snippets Groups Projects
Commit c101608a authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

Add CMake support for IPOpt

It works for me with the Debian packages for IPOpt.
parent 6e9d5b16
No related branches found
No related tags found
No related merge requests found
function(add_dune_ipopt_flags _targets)
if(IPOPT_FOUND)
cmake_parse_arguments(ADD_DUNE_IPOPT_FLAGS "OBJECT" "" "" ${ARGN})
foreach(_target ${_targets})
target_compile_options(${_target} PRIVATE ${DUNE_IPOPT_CFLAGS})
if(NOT ADD_DUNE_IPOPT_FLAGS_OBJECT)
target_link_libraries(${_target} ${IPOPT_LIBRARY})
endif()
endforeach(_target ${_targets})
endif(IPOPT_FOUND)
endfunction(add_dune_ipopt_flags)
set(modules "DuneSolversMacros.cmake") install(FILES
DuneSolversMacros.cmake
install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR}) FindIPOpt.cmake
AddIPOptFlags.cmake
DESTINATION ${DUNE_INSTALL_MODULEDIR})
# File for module specific CMake tests. # File for module specific CMake tests.
find_package(IPOpt)
include(AddIPOptFlags)
find_package(PkgConfig REQUIRED)
include(FindPackageHandleStandardArgs)
pkg_check_modules(IPOPT ipopt)
find_package_handle_standard_args(Ipopt DEFAULT_MSG IPOPT_FOUND)
find_library(IPOPT_LIBRARY ipopt HINTS "${IPOPT_LIBDIR}")
set(HAVE_IPOPT ENABLE_IPOPT)
if(IPOPT_FOUND)
set(DUNE_IPOPT_CFLAGS ${IPOPT_CFLAGS} -DENABLE_IPOPT=1)
foreach(dir ${PSURFACE_INCLUDE_DIRS})
set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}")
endforeach()
endif(IPOPT_FOUND)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment