Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake : include FindPackageHandleStandardArgs.cmake

Tags:

module

cmake

In many cmake find modules, we find INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") I would like to do the same thing but from the CMakeLists of my project. The problem is that ${CMAKE_CURRENT_LIST_DIR} is pointing to the directory of my project... And FindPackageHandleStandardArgs.cmake is in /usr/share/cmake-2.8/Modules/.

Is there a CMake variable that is pointing to the cmake module directory ? If not, how to do that in my CMakeLists (I want that to be portable and not to be "hardcoded") ?

Thank you very much.

like image 767
Vincent Avatar asked Dec 22 '22 10:12

Vincent


2 Answers

If a module file is specified, the include command will search the CMake module directory automatically. Just use:

include(FindPackageHandleStandardArgs)
like image 64
sakra Avatar answered Dec 28 '22 10:12

sakra


If you've changed the CMAKE_MODULE_PATH variable (which is usually the case when creating a custom Find*.cmake), you can do:

include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs)

like image 26
quimnuss Avatar answered Dec 28 '22 09:12

quimnuss