开发者

Cmake : include 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜