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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With