Search code examples
cmakeroscatkin

CMake Error: include could not find load file


i'm trying to install and use the library "ifopt" in a project but i get some errors

I have used the following commands (like here: https://github.com/ethz-adrl/ifopt/blob/master/README.md):

sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev
git clone https://github.com/ethz-adrl/ifopt.git
cd ifopt
mkdir build 
cd build
cmake ..
make
sudo make install

Then i added to my CMakeLists:

find_package(ifopt)
add_executable(testifopt src/testifopt.cpp)
target_link_libraries(testifopt PUBLIC ifopt::ifopt_ipopt) 

And this is what i get, using catkin_make:

CMake Error at /home/simone/ifopt/ifopt-config.cmake:40 (include): include could not find load file: /home/simone/ifopt/ifopt_core-targets.cmake    
Call Stack (most recent call first): push_optimal_planner/CMakeLists.txt:30 (find_package)


CMake Warning (dev) at /home/simone/ifopt/ifopt-config.cmake:44 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
get_target_property() called with non-existent target "ifopt::ifopt_core".
Call Stack (most recent call first): push_optimal_planner/CMakeLists.txt:30 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /home/simone/ifopt/ifopt-config.cmake:47 (get_property): get_property could not find TARGET ifopt::ifopt_core. Perhaps it has not yet been created.
Call Stack (most recent call first): push_optimal_planner/CMakeLists.txt:30 (find_package)

What's wrong? Thanks for your help.


Solution

  • Solved,

    I needed to update Ros, reinstall IfOpt and also i added to the CMakeLists this line:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")