0

I want to ask you a little question. In a project based on gnu-autotools I can use use my library(libtest based on gnu autotools) with a construction "pkg-config --cflags libtest" for include directory.

But the project based on Cmake I must use *.cmake config files (Or construction include_directories ("/usr/local/include/libtest") but this is ugly in my opinion).

How can I write and add this *.cmake files in my library? Do you know any library where I can see example? Or where I can read about this?

Regards, max

Max
  • 817
  • 1
  • 10
  • 29
  • 1
    CMake has a ready module for `pkg-config`: https://stackoverflow.com/questions/29191855/what-is-the-proper-way-to-use-pkg-config-from-cmake. So simply use `pkg_check_modules` instead of `find_package`. (Some `FindXXX.cmake` scripts use `pkg_check_modules` by themselves). – Tsyvarev Nov 27 '20 at 23:12
  • @Tsyvarev thank you. this 3 line help me : find_package(PkgConfig REQUIRED) pkg_check_modules(libtest REQUIRED libtest) include_directories (${libtest_INCLUDE_DIRS}) – Max Nov 28 '20 at 12:27

0 Answers0