Compile C++ project with cmake and or-tools

746 views
Skip to first unread message

VICTOR CASTRO SERRANO

unread,
Apr 28, 2022, 10:42:18 AM4/28/22
to or-tools-discuss
Hello everyone. I have installed or-tools from the source as in the official docs, because the instructions in the readme of the binaries folder did not work out.

I am trying use or-tools with my project, but I am having problems to link the library with cmake. I have added "find_package(ortools REQUIRED)" to CMakeLists.txt, and created a file "Findortools.cmake" as discusses in this issue. Unfortunately, I still get an error, and I do not know what else to do. I have been searching around unsuccessfully. I really appreciate any helps. The error when executing cmake -Bbuild is the following:

CMake Error at /snap/cmake/1082/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find ortools (missing: ORTOOLS_LIBRARIES ORTOOLS_INCLUDE_DIRS)
Call Stack (most recent call first):
  /snap/cmake/1082/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/Findortools.cmake:92 (find_package_handle_standard_args)
  CMakeLists.txt:7 (find_package)

Mizux Seiha

unread,
Apr 28, 2022, 4:20:05 PM4/28/22
to or-tools-discuss
> "from the source"
0) On which OS did you work ?
1) Which branch did you use ?
2) Which build system did you use ?

Fabion Kauker

unread,
Apr 29, 2022, 1:25:30 AM4/29/22
to or-tools...@googlegroups.com
I also have been using OR-Tools in C++ but ended up just using make.

Here is a template which might help - https://github.com/fhk/mini_or_tools

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/8c9b99f3-0a97-44b6-b2b1-4226fb979544n%40googlegroups.com.

VICTOR CASTRO SERRANO

unread,
Apr 29, 2022, 2:20:41 AM4/29/22
to or-tools-discuss
Sorry, I should have specified better. I thought it was a more generic problem.
0) I work in Ubuntu 20.0.4 LTS.
1) the stable version. I downloaded the repo as a zip file (following the instructions)
2) C++, cmake 3.23.1

VICTOR CASTRO SERRANO

unread,
Apr 29, 2022, 2:23:39 AM4/29/22
to or-tools-discuss
Unfortunately I must use cmake due to project constraints, but I am going to take a look at it, Thanks!

VICTOR CASTRO SERRANO

unread,
Apr 29, 2022, 2:25:47 AM4/29/22
to or-tools-discuss
By the way, the problem is the same as here. I have seen you @Mizux has replied to both. Thanks for trying to help

Mizux Seiha

unread,
Apr 29, 2022, 2:42:48 AM4/29/22
to or-tools-discuss
I'll try to update https://github.com/or-tools/cmake_or-tools and generate a ubuntu 20.04 archive using master branch (to have cmake support directly)

VICTOR CASTRO SERRANO

unread,
May 13, 2022, 3:09:03 AM5/13/22
to or-tools-discuss
Thank you so much, I really appreciate it. Sorry for the late response
Reply all
Reply to author
Forward
0 new messages