开发者

Cmake : include FindPackageHandleStandardArgs.cmake

开发者 https://www.devze.com 2023-03-27 02:55 出处:网络
In many cmake find modules, we find INCLUDE(\"${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.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.


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

include(FindPackageHandleStandardArgs)


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号