Benjamin Horowitz
Benjamin Horowitz

Reputation: 624

Specify Location of Cmake Find[Package]

I'm trying to find a given package using a FindX.cmake file. Unfortunately, it seems like it continues to use one located at /A/FindX.cmake, rather than a different one at /B/FindX.cmake. Is there a way to specify the location of which Find[Package].cmake is used by find_package(X)?

Upvotes: 2

Views: 271

Answers (1)

Tsyvarev
Tsyvarev

Reputation: 66118

Simply add path /B to the beginning of the CMAKE_MODULE_PATH variable:

set(CMAKE_MODULE_PATH "/B" ${CMAKE_MODULE_PATH})

Such way CMake will prefer FindX.cmake script from /B to scripts in other directories.

Upvotes: 1

Related Questions