Closed FlorianXXIV closed 2 months ago
I think you need to set
set(BUILD_DEPS ON)
before the FetchContent_MakeAvailable(or-tools)
see: https://github.com/or-tools/cmake_or-tools/blob/7bfb4a04518d377d88c342637c46bf6faad3c3a0/CMakeLists.txt#L87-L96
clion-Debug-log.txt CMakeLists.txt
I tried doing that but I still get the same error. I have added the debug log and changed CMakeLists.txt, it seems to fail after cloning cbc.
Ok, I have found the issue. I am using curl for people (cpr) in the project as well, and that builds curl which also builds zlib, having both or-tools and curl install zlib separatly seemed to have caused the issue. I have now restructured the make available statements and made cpr look for curl instead of building it itself.
This is the CMakeLists that worked for me CMakeLists.txt having the following order of make available statements
set(SKIP_TESTS ON)
set(SKIP_EXAMPLES ON)
set(SKIP_BENCHMARKS ON)
FetchContent_MakeAvailable(graaflib)
set(BUILD_DEPS ON)
set(BUILD_EXAMPLES OFF)
set(BUILD_SAMPLES OFF)
set(BUILD_DOC OFF)
set(USE_SCIP OFF)
set(USE_HIGHS OFF)
FetchContent_MakeAvailable(or-tools)
set(CPR_USE_SYSTEM_CURL ON)
FetchContent_MakeAvailable(cpr)
FetchContent_MakeAvailable(argparse)
FetchContent_MakeAvailable(plog)
FetchContent_MakeAvailable(json)
What version of OR-Tools and what language are you using? Version: main Language: C++
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
What operating system (Linux, Windows, ...) and version?
What did you do? Steps to reproduce the behavior:
FetchContent_MakeAvailable(or-tools)
target_link_libraries( PRIVATE ortools::ortools)
CMake Error at build/_deps/or-tools-src/cmake/deps.cmake:29 (message): Target ZLIB::ZLIB not available. Call Stack (most recent call first): build/_deps/or-tools-src/CMakeLists.txt:429 (include) -- Configuring incomplete, errors occurred! See also "/build/CMakeFiles/CMakeOutput.log".
See also "/build/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found. Stop.