Ask Your Question

How is OpenCVConfig.cmake detectable by cmake on windows

asked 2014-11-20 04:21:16 -0500

thgis gravatar image


I have downloaded opencv 3 source, build and installed both debug and release. (I'm using VS12 64 bit)

I now have an install folder with all the needed files. I added the absolute path of "..\install\x64\vc12\bin" to the environment path variable to be able to load the dll's (examples work so this is fine i believe)

Directly in the install folder I have two cmake files: OpenCVConfig.cmake OpenCVConfig-version.cmake

In the "install\x64\vc12\lib" folder there is also a number of cmake files: OpenCVConfig.cmake OpenCVModules.cmake OpenCVModules-debug.cmake OpenCVModules-release.cmake

So lots of cmake files. The question is: how is the .cmake files detectable in a CMakeLists.txt of another project so I'm able to write find_package(Opencv REQUIRE)? I would expect that I need to point to one of the two parent directories containing the cmake files.

Without having done anything other than adding the bin path to the environment path variable it seems that cmake is able to find the OpenCVConfig.cmake files, but I cant figure out how?

I can't find other environment variables that holds any information about opencv install paths.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-20 07:18:51 -0500

This behavior depends on the operating system. I assume you are on windows, the path is found thanks to cmake-gui: according to documentation (section 5.), find_package will search for project in build trees recently configured in a cmake-gui. But you can deactivate this behavior using "NO_CMAKE_BUILDS_PATH" constant in your CmakeLists.txt file...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-11-20 04:21:16 -0500

Seen: 586 times

Last updated: Nov 20 '14