-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from bluescarni/pr/private_tbb
Turn TBB/NLopt/Ipopt into PRIVATE dependencies for libpagmo
- Loading branch information
Showing
8 changed files
with
130 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
cmake_minimum_required(VERSION 3.3) | ||
|
||
project(uda_basic) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
cmake_minimum_required(VERSION 3.3) | ||
|
||
project(udp_basic) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,57 @@ | ||
if(IPOPT_INCLUDE_DIR AND IPOPT_LIBRARY) | ||
# Already in cache, be silent | ||
set(IPOPT_FIND_QUIETLY TRUE) | ||
include(FindPackageHandleStandardArgs) | ||
|
||
message(STATUS "Requested IPOPT components: ${IPOPT_FIND_COMPONENTS}") | ||
|
||
# Check the components that were passed to find_package(). | ||
set(_IPOPT_ALLOWED_COMPONENTS header libipopt) | ||
foreach(_IPOPT_CUR_COMPONENT ${IPOPT_FIND_COMPONENTS}) | ||
if(NOT ${_IPOPT_CUR_COMPONENT} IN_LIST _IPOPT_ALLOWED_COMPONENTS) | ||
message(FATAL_ERROR "'${_IPOPT_CUR_COMPONENT}' is not a valid component for IPOPT.") | ||
endif() | ||
endforeach() | ||
unset(_IPOPT_ALLOWED_COMPONENTS) | ||
|
||
# Setup the list of arguments to be passed to | ||
# find_package_handle_standard_args(). | ||
set(_IPOPT_FPHSA_ARGS) | ||
|
||
if ("header" IN_LIST IPOPT_FIND_COMPONENTS) | ||
# The header component was requested. | ||
# The associated variable is IPOPT_INCLUDE_DIR. | ||
list(APPEND _IPOPT_FPHSA_ARGS IPOPT_INCLUDE_DIR) | ||
find_path(IPOPT_INCLUDE_DIR NAMES IpIpoptNLP.hpp PATH_SUFFIXES coin) | ||
endif() | ||
|
||
find_path(IPOPT_INCLUDE_DIR NAMES IpIpoptNLP.hpp PATH_SUFFIXES coin) | ||
find_library(IPOPT_LIBRARY NAMES ipopt) | ||
if ("libipopt" IN_LIST IPOPT_FIND_COMPONENTS) | ||
# The libipopt component was requested. | ||
# The associated variable is IPOPT_LIBRARY. | ||
list(APPEND _IPOPT_FPHSA_ARGS IPOPT_LIBRARY) | ||
find_library(IPOPT_LIBRARY NAMES ipopt) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
# Run the standard find_package() machinery. | ||
find_package_handle_standard_args(IPOPT DEFAULT_MSG ${_IPOPT_FPHSA_ARGS}) | ||
unset(_IPOPT_FPHSA_ARGS) | ||
|
||
find_package_handle_standard_args(IPOPT DEFAULT_MSG IPOPT_INCLUDE_DIR IPOPT_LIBRARY) | ||
if("header" IN_LIST IPOPT_FIND_COMPONENTS) | ||
mark_as_advanced(IPOPT_INCLUDE_DIR) | ||
|
||
if(IPOPT_FOUND AND NOT TARGET IPOPT::header) | ||
message(STATUS "Creating the 'IPOPT::header' imported target.") | ||
add_library(IPOPT::header INTERFACE IMPORTED) | ||
message(STATUS "Path to the ipopt headers: ${IPOPT_INCLUDE_DIR}") | ||
set_target_properties(IPOPT::header PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${IPOPT_INCLUDE_DIR}") | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(IPOPT_INCLUDE_DIR IPOPT_LIBRARY) | ||
if ("libipopt" IN_LIST IPOPT_FIND_COMPONENTS) | ||
mark_as_advanced(IPOPT_LIBRARY) | ||
|
||
# NOTE: this has been adapted from CMake's FindPNG.cmake. | ||
if(IPOPT_FOUND AND NOT TARGET IPOPT::ipopt) | ||
add_library(IPOPT::ipopt UNKNOWN IMPORTED) | ||
set_target_properties(IPOPT::ipopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${IPOPT_INCLUDE_DIR}") | ||
set_target_properties(IPOPT::ipopt PROPERTIES IMPORTED_LOCATION "${IPOPT_LIBRARY}") | ||
if(IPOPT_FOUND AND NOT TARGET IPOPT::libipopt) | ||
message(STATUS "Creating the 'IPOPT::libipopt' imported target.") | ||
# Otherwise, we proceed as usual. | ||
message(STATUS "Path to libipopt: ${IPOPT_LIBRARY}") | ||
add_library(IPOPT::libipopt UNKNOWN IMPORTED) | ||
set_target_properties(IPOPT::libipopt PROPERTIES IMPORTED_LOCATION "${IPOPT_LIBRARY}") | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,59 @@ | ||
if(NLOPT_INCLUDE_DIR AND NLOPT_LIBRARY) | ||
# Already in cache, be silent | ||
set(NLOPT_FIND_QUIETLY TRUE) | ||
include(FindPackageHandleStandardArgs) | ||
|
||
message(STATUS "Requested NLOPT components: ${NLOPT_FIND_COMPONENTS}") | ||
|
||
# Check the components that were passed to find_package(). | ||
set(_NLOPT_ALLOWED_COMPONENTS header libnlopt) | ||
foreach(_NLOPT_CUR_COMPONENT ${NLOPT_FIND_COMPONENTS}) | ||
if(NOT ${_NLOPT_CUR_COMPONENT} IN_LIST _NLOPT_ALLOWED_COMPONENTS) | ||
message(FATAL_ERROR "'${_NLOPT_CUR_COMPONENT}' is not a valid component for NLOPT.") | ||
endif() | ||
endforeach() | ||
unset(_NLOPT_ALLOWED_COMPONENTS) | ||
|
||
# Setup the list of arguments to be passed to | ||
# find_package_handle_standard_args(). | ||
set(_NLOPT_FPHSA_ARGS) | ||
|
||
if ("header" IN_LIST NLOPT_FIND_COMPONENTS) | ||
# The header component was requested. | ||
# The associated variable is NLOPT_INCLUDE_DIR. | ||
list(APPEND _NLOPT_FPHSA_ARGS NLOPT_INCLUDE_DIR) | ||
find_path(NLOPT_INCLUDE_DIR NAMES nlopt.h) | ||
endif() | ||
|
||
find_path(NLOPT_INCLUDE_DIR NAMES nlopt.h) | ||
find_library(NLOPT_LIBRARY NAMES nlopt) | ||
if ("libnlopt" IN_LIST NLOPT_FIND_COMPONENTS) | ||
# The libnlopt component was requested. | ||
# The associated variable is NLOPT_LIBRARY. | ||
list(APPEND _NLOPT_FPHSA_ARGS NLOPT_LIBRARY) | ||
find_library(NLOPT_LIBRARY NAMES nlopt) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
# Run the standard find_package() machinery. | ||
find_package_handle_standard_args(NLOPT DEFAULT_MSG ${_NLOPT_FPHSA_ARGS}) | ||
unset(_NLOPT_FPHSA_ARGS) | ||
|
||
find_package_handle_standard_args(NLOPT DEFAULT_MSG NLOPT_INCLUDE_DIR NLOPT_LIBRARY) | ||
if("header" IN_LIST NLOPT_FIND_COMPONENTS) | ||
mark_as_advanced(NLOPT_INCLUDE_DIR) | ||
|
||
if(NLOPT_FOUND AND NOT TARGET NLOPT::header) | ||
message(STATUS "Creating the 'NLOPT::header' imported target.") | ||
add_library(NLOPT::header INTERFACE IMPORTED) | ||
message(STATUS "Path to the nlopt.h header: ${NLOPT_INCLUDE_DIR}") | ||
set_target_properties(NLOPT::header PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${NLOPT_INCLUDE_DIR}") | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(NLOPT_INCLUDE_DIR NLOPT_LIBRARY) | ||
if ("libnlopt" IN_LIST NLOPT_FIND_COMPONENTS) | ||
mark_as_advanced(NLOPT_LIBRARY) | ||
|
||
# NOTE: this has been adapted from CMake's FindPNG.cmake. | ||
if(NLOPT_FOUND AND NOT TARGET NLOPT::nlopt) | ||
add_library(NLOPT::nlopt UNKNOWN IMPORTED) | ||
set_target_properties(NLOPT::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${NLOPT_INCLUDE_DIR}") | ||
set_target_properties(NLOPT::nlopt PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
IMPORTED_LOCATION "${NLOPT_LIBRARY}") | ||
if(NLOPT_FOUND AND NOT TARGET NLOPT::libnlopt) | ||
message(STATUS "Creating the 'NLOPT::libnlopt' imported target.") | ||
# Otherwise, we proceed as usual. | ||
message(STATUS "Path to libnlopt: ${NLOPT_LIBRARY}") | ||
add_library(NLOPT::libnlopt UNKNOWN IMPORTED) | ||
set_target_properties(NLOPT::libnlopt PROPERTIES | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
IMPORTED_LOCATION "${NLOPT_LIBRARY}") | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters