Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Could NOT find pagmo_IPOPT (missing: PAGMO_IPOPT_INCLUDE_DIR) #529

Open
intractabilis opened this issue Dec 24, 2022 · 1 comment
Open
Labels

Comments

@intractabilis
Copy link

intractabilis commented Dec 24, 2022

Describe the bug
pagmo needs manual specification of PAGMO_IPOPT_INCLUDE_DIR, otherwise Findpagmo_IPOPT.cmake fails with an error.

To Reproduce
Build pagmo with PAGMO_WITH_IPOPT=ON, create a project with the following meson.build

project('test', ['cpp'], version : '0.1')
pagmo_dep = dependency('pagmo', method: 'cmake')
executable(test, 'test.cpp', dependencies: [pagmo_dep])

Run meson setup build. Meson will fail to find pagmo with the following message in the log file:

ERR:
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find pagmo_IPOPT (missing: PAGMO_IPOPT_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /somewhere/gcc-env/lib/cmake/pagmo/Findpagmo_IPOPT.cmake:33 (find_package_handle_standard_args)
  /somewhere/gcc-env/lib/cmake/pagmo/pagmo-config.cmake:13 (find_package)
  CMakeLists.txt:16 (find_package)

Please, use pkgconf to find PAGMO_IPOPT_INCLUDE_DIR. Suggested change for Findpagmo_IPOPT.cmake:

@@ -15,6 +15,9 @@ unset(_pagmo_IPOPT_ALLOWED_COMPONENTS)
 # find_package_handle_standard_args().
 set(_pagmo_IPOPT_FPHSA_ARGS)
 
+find_package(PkgConfig REQUIRED)
+pkg_get_variable(PAGMO_IPOPT_INCLUDE_DIR ipopt includedir)
+
 if ("header" IN_LIST pagmo_IPOPT_FIND_COMPONENTS)
     # The header component was requested.
     # The associated variable is PAGMO_IPOPT_INCLUDE_DIR.
@bluescarni
Copy link
Member

bluescarni commented Jan 6, 2023

I am not sure pkgconfig is the way to go, since as far as I recall it's not really well-supported/widespread in Windows environments.

In out CI, IPOPT is located without much effort even when installed in non-standard paths (e.g., from a conda environment). Could you give a bit more context/explanation about the error? E.g., were the CMAKE_INSTALL_PREFIX and CMAKE_PREFIX_PATH CMake variables set up properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants