2

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)?

Benjamin Horowitz
  • 604
  • 1
  • 8
  • 10
  • 1
    Possible duplicate of [Hinting Find.cmake Files with a custom directory](https://stackoverflow.com/questions/34795816/hinting-findname-cmake-files-with-a-custom-directory) – Florian Feb 09 '18 at 18:44

1 Answers1

1

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.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153