gpt4 book ai didi

cmake - 使用 cmake 时 find_package() 函数的默认搜索路径是什么?

转载 作者:行者123 更新时间:2023-12-04 16:08:15 57 4
gpt4 key购买 nike

我也想知道 find_package(<package>) 时设置的默认变量发现 <package>在 Linux (Ubuntu) 中?

最佳答案

把我的评论变成答案

如果您必须将其分解为“最重要的单一”路径,它将是 CMake's own module path含预装Find...模块。

将 CMake 指向自定义路径的最重要的全局变量是 CMAKE_MODULE_PATH .

如果您想查看 CMake 在您的情况下搜索哪些目录,只需调用

 cmake -D CMAKE_FIND_DEBUG_MODE=ON ..

整个“搜索算法”记录在 find_package() command documentation 中:

  1. Search paths specified in cmake-specific cache variables. This can be skipped if NO_CMAKE_PATH is passed:

    CMAKE_PREFIX_PATH
    CMAKE_FRAMEWORK_PATH
    CMAKE_APPBUNDLE_PATH
  2. Search paths specified in cmake-specific environment variables. This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed:

    <package>_DIR
    CMAKE_PREFIX_PATH
    CMAKE_FRAMEWORK_PATH
    CMAKE_APPBUNDLE_PATH
  3. Search paths specified by the HINTS option. Hard-coded guesses should be specified with the PATHS option.

  4. Search the standard system environment variables. This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is passed:

    PATH
  5. Search paths stored in the CMake User Package Registry. This can be skipped if NO_CMAKE_PACKAGE_REGISTRY is passed or by setting the CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY to TRUE.

  6. Search cmake variables defined in the Platform files for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is passed:

    CMAKE_SYSTEM_PREFIX_PATH
    CMAKE_SYSTEM_FRAMEWORK_PATH
    CMAKE_SYSTEM_APPBUNDLE_PATH
  7. Search paths stored in the CMake System Package Registry. This can be skipped if NO_CMAKE_SYSTEM_PACKAGE_REGISTRY is passed or by setting the CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY to TRUE.

  8. Search paths specified by the PATHS option. These are typically hard-coded guesses.

关于cmake - 使用 cmake 时 find_package(<package>) 函数的默认搜索路径是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43927936/

57 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com