Skip to content

Unable to find_package after a source build in custom location #1

@onecable5781

Description

@onecable5781

Hi @Mizux

I am trying to follow the advice you gave me over on the other thread.

As indicated there, I have installed OR Tools on Windows Visual Studio 2022 using the steps mentioned on the website.

Now, I performed the steps exactly as mentioned on https://developers.google.com/optimization/install/cpp/source_windows

from my local drive: E:\ortools

Now, after all steps are run, the folder structure is E:\ortools\or-tools\ .git and other subfolders here such as bazel\ , binder\ , build\ , cmake\ , ortools\ etc.

I have my project folder elsewhere, say, C:\myproject\CMakeLists.txt

Within this CMakeLists.txt, the following find_package() line fails.

 set(ortools_loc_2 "E:\\ortools\\or-tools\\ortools")
 if(EXISTS "${ortools_loc_2}" AND IS_DIRECTORY "${ortools_loc_2}")
     message(STATUS "ortools exists on this machine")
     set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "E:\\ortools\\or-tools\\ortools") # should ideally go in presets file see https://www.reddit.com/r/cpp_questions/comments/17r5g6r/comment/k8imfvs/
     find_package(ortools CONFIG REQUIRED)
     set(ortoolsfound 1)

Could you please suggest how I can inform my project's CMakeLists.txt to find the source built ORTools of my custom location?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions