Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use CMAKE_MODULE_PATH correctly on windows

Tags:

cmake

What is the proper way to modify this variable so that CMake can find the appropriate modules that projects specify as requirements? It seems to be autogenerated and I cannot find environment variables that would modify this path in any way. I also am hard pressed to find documentation that explains this well; only instructions to "install" CMake packages with no details on how exactly that can be accomplished.

like image 743
xaav Avatar asked Jul 18 '17 21:07

xaav


People also ask

How does Find_package work in Windows?

For find_package CMake offers a special mechanism on Windows called the package registry. CMake maintains a list of package information in the Windows registry under HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\ . Packages build from source can register there using the export command.

What is the default Cmake_module_path?

Semicolon-separated list of directories specifying a search path for CMake modules to be loaded by the include() or find_package() commands before checking the default modules that come with CMake. By default it is empty, it is intended to be set by the project.

What are CMake modules?

A module is defined with CMake scripts that inform the build system of its contents and dependencies. The modularization effort significantly improves the extensibility of the toolkit and lowers the barrier to contribution. Modules are organized into: The top level directory.


1 Answers

You can extend or set the module path like so:

list(APPEND CMAKE_MODULE_PATH "some path to modules")

or:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "path")

Just like you can any other (list) variable.

like image 125
utopia Avatar answered Sep 23 '22 22:09

utopia