0

I am using Qt Creator as IDE and MSVC 2019. I built and installed the pagmo library from the source. Now I am trying to use it for my project.

Even though the installation seems fine, when I try to load it I get strange errors, telling me that "pagmo" is not found. In particular:

error:
 By not providing "FindPagmo.cmake" in CMAKE_MODULE_PATH this project has
 asked CMake to find a package configuration file provided by "Pagmo",
 but CMake did not find one.

  Could not find a package configuration file provided by "Pagmo" with any
  of the following names:

    PagmoConfig.cmake
    pagmo-config.cmake

  Add the installation prefix of "Pagmo" to CMAKE_PREFIX_PATH or set 
  "Pagmo_DIR" to a directory containing one of the above files. If
  "Pagmo" provides a separate development package or SDK, be sure it has
  been installed.

In my CMakeLists.txt I have set the following command:

  • find_package(Pagmo REQUIRED)

Now, as far as I know FindPagmo.cmake does not exist, BUT I am giving as input parameter Pagmo_DIR, which contains the file pagmo-config.cmake. I can't understand why CMake is not finding it. I also tried to set CMAKE_MODULE_PATH to the same folder but nothing changed.

Does anybody have suggestions on how to solve this problem?

I am setting pagmo directory as follows:

-DPagmo_DIR = C:\Lib\pagmo\install\debug\lib\cmake\pagmo

in that folder I have the following files:

  • Findpagmo_IPOPT.cmake;
  • pagmo_export.cmake;
  • pagmo_export-debug.cmake;
  • pagmo-config.cmake;
  • pagmo-config-version.cmake;
  • PagmoFindBoost.cmake
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
mz_97
  • 15
  • 5
  • Show the relevant parts: `find_package`, how you set `Pagmo_DIR` what is the content of the folder you set `Pagmo_DIR` to. `CMAKE_MODULE_PATH` is useless if you don't have FindPagmo.cmake. – ixSci Apr 21 '22 at 08:06
  • Thanks for the suggestion, I have updated the question with further details. – mz_97 Apr 21 '22 at 08:14
  • Try `-DPagmo_DIR=C:/Lib/pagmo/install/debug/lib/cmake/pagmo` – ixSci Apr 21 '22 at 08:16
  • I tried, but nothing changed – mz_97 Apr 21 '22 at 08:19
  • @ixSci: Please, do not format error messages using *blockquote*. This formatting doesn't preserve **newlines**, making the text harder to read and interpret. Instead, use **code** formatting. – Tsyvarev Apr 21 '22 at 08:19
  • @Tsyvarev in this case it is impossible to read with the code formatting. – ixSci Apr 21 '22 at 08:22
  • 1
    Add `message("Pagmo dir: '${Pagmo_DIR}'")` right before `find_package(Pagmo REQUIRED)` and show us the output. – ixSci Apr 21 '22 at 08:23
  • @ixSci: Yes, the post initially contains the error message where newlines (and indentations) has already been missed. I have fixed it according to usual output of CMake in such cases. – Tsyvarev Apr 21 '22 at 08:31
  • @ixSci Adding this message returns the following output: `Pagmo dir: '' ` – mz_97 Apr 21 '22 at 08:33
  • Now you have your answer, you do not set the variable. Find out why you don't do it and fix it. – ixSci Apr 21 '22 at 08:35
  • 1
    Thank you,@ixSci I succeeded in loading pagmo in the end. I was setting CMake commands with the `batch edit` option and somehow it would not work. Using instead `additional cmake options` it worked. – mz_97 Apr 21 '22 at 08:52

0 Answers0