5

I made and installed the aruco library, which put a Findaruco.cmake file in the /usr/local/lib/cmake directory. In my CMakeLists.txt file I have

...
find_package(aruco REQUIRED)

and it always returns the standard error

By not providing "Findaruco.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "aruco", but
CMake did not find one.

Could not find a package configuration file provided by "aruco" with any of
the following names:

    arucoConfig.cmake
    aruco-config.cmake

Add the installation prefix of "aruco" to CMAKE_PREFIX_PATH or set
"aruco_DIR" to a directory containing one of the above files.  If "aruco"
provides a separate development package or SDK, be sure it has been
installed.

I've set the environment variable $CMAKE_PREFIX_PATH to each of the following, and none work

/usr/local  
/usr/local/lib  
/usr/local/lib/cmake  

The only thing that works is setting the following in CMakeLists

set(CMAKE_MODULE_PATH /usr/local/lib/cmake)

I'm not sure what I'm doing wrong

Anup
  • 103
  • 1
  • 2
  • 10
  • CMake documents where it looks for CMake modules: https://cmake.org/cmake/help/v3.0/command/find_package.html So the module path looks more suited to me compared to the prefix path. – usr1234567 Oct 21 '15 at 07:15

1 Answers1

6

Try setting CMake variable called CMAKE_PREFIX_PATH, not the environment one. Use -D flag during cmake invocation:

cmake -D CMAKE_PREFIX_PATH=/usr/local/lib <path to source or build dir>

But AFAIR, CMake should look into /usr/local prefix as its default behavior.

arrowd
  • 33,231
  • 8
  • 79
  • 110
  • 2
    This could be a better way instead - https://stackoverflow.com/questions/20746936/cmake-of-what-use-is-find-package-if-you-need-to-specify-cmake-module-path-an – tauseef_CuriousGuy Feb 15 '19 at 10:41