influence of NO_CMAKE_PACKAGE_REGISTRY on CMake find_package() -
i have following cmakelists.txt
:
cmake_minimum_required(version 2.6) set(cmake_module_path "${cmake_source_dir}/cmake") find_package(foo quiet no_cmake_package_registry) if (foo_found) message("foo found") else (foo_found) message("foo not found") endif (foo_found) find_package(foo quiet) if (foo_found) message("foo (2) found") else (foo_found) message("foo (2) not found") endif (foo_found)
there file ${cmake_source_dir}/cmake/findfoo.cmake
. however, when run cmake
detects package foo
in second case only:
-- (...) -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done foo not found foo (2) found -- configuring done -- generating done -- build files have been written to: /home/me/tmp/build
my understanding of documentation no_cmake_package_registry
forbids find_package()
@ ~/.cmake/package/foo
have nothing here. have same behavior cmake 2.8.9 , cmake 3.5.1.
why find_package()
not find file in first case ?
there 2 modes of find_package: first one, simple, searches findfoo.cmake
module, second one, more complex, searches fooconfig.cmake
config file.
by default, cmake tries both modes, module mode finds file.
but option no_cmake_package_registry
applicable config mode, cannot find file in case. same effect caused by
find_package(foo no_module)
Comments
Post a Comment