CMake: как получить переменную PATHS для find_package? - PullRequest
0 голосов
/ 05 августа 2020

Вот пример того, как указать переменную PATHS, чтобы cmake мог найти библиотеку: cmake find_package указать путь Но как получить эту PATHS переменную для указанной c библиотеки?

Например, я установил apt-get install libharfbuzz-dev, а dpkg -L libharfbuzz-dev показывает мне:

/usr
/usr/include
/usr/include/harfbuzz
/usr/include/harfbuzz/hb-blob.h
/usr/include/harfbuzz/hb-buffer.h
/usr/include/harfbuzz/hb-common.h
/usr/include/harfbuzz/hb-deprecated.h
/usr/include/harfbuzz/hb-face.h
/usr/include/harfbuzz/hb-font.h
/usr/include/harfbuzz/hb-ft.h
/usr/include/harfbuzz/hb-glib.h
/usr/include/harfbuzz/hb-gobject-enums.h
/usr/include/harfbuzz/hb-gobject-structs.h
/usr/include/harfbuzz/hb-gobject.h
/usr/include/harfbuzz/hb-graphite2.h
/usr/include/harfbuzz/hb-icu.h
/usr/include/harfbuzz/hb-ot-font.h
/usr/include/harfbuzz/hb-ot-layout.h
/usr/include/harfbuzz/hb-ot-math.h
/usr/include/harfbuzz/hb-ot-shape.h
/usr/include/harfbuzz/hb-ot-tag.h
/usr/include/harfbuzz/hb-ot-var.h
/usr/include/harfbuzz/hb-ot.h
/usr/include/harfbuzz/hb-set.h
/usr/include/harfbuzz/hb-shape-plan.h
/usr/include/harfbuzz/hb-shape.h
/usr/include/harfbuzz/hb-unicode.h
/usr/include/harfbuzz/hb-version.h
/usr/include/harfbuzz/hb.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libharfbuzz-gobject.a
/usr/lib/x86_64-linux-gnu/libharfbuzz-icu.a
/usr/lib/x86_64-linux-gnu/libharfbuzz.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/harfbuzz-gobject.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/harfbuzz-icu.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/harfbuzz.pc
/usr/share
/usr/share/doc
/usr/share/doc/libharfbuzz-dev
/usr/share/doc/libharfbuzz-dev/copyright
/usr/share/gir-1.0
/usr/share/gir-1.0/HarfBuzz-0.0.gir
/usr/lib/x86_64-linux-gnu/libharfbuzz-gobject.so
/usr/lib/x86_64-linux-gnu/libharfbuzz-icu.so
/usr/lib/x86_64-linux-gnu/libharfbuzz.so
/usr/share/doc/libharfbuzz-dev/changelog.Debian.gz

Какой путь мне использовать?

Обновление:

Сообщение об ошибке:

CMake Error at <some_path>/CMakeLists.txt:6 (find_package):
  By not providing "FindHarfbuzz.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Harfbuzz",
  but CMake did not find one.

  Could not find a package configuration file provided by "Harfbuzz" with any
  of the following names:

    HarfbuzzConfig.cmake
    harfbuzz-config.cmake

  Add the installation prefix of "Harfbuzz" to CMAKE_PREFIX_PATH or set
  "Harfbuzz_DIR" to a directory containing one of the above files.  If
  "Harfbuzz" provides a separate development package or SDK, be sure it has
  been installed.

Я пытался добавить путь через CMAKE_PREFIX_PATH, например cmake .. -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu, но это не помогло.

...