Including glib.h in a CMake project

后端 未结 1 939
不思量自难忘°
不思量自难忘° 2021-01-05 12:38

Trying to compile a library in Ubuntu with CMake and one of the file includes glib.h. The package is installed and glib.h is in /usr/include/glib-2.0/glib

1条回答
  •  -上瘾入骨i
    2021-01-05 13:24

    I suggest you go through the link: How package finding works.

    As a reference, you can have a look at this CMake Module for finding glib2.

    The line of your interest here is:

    find_path(GLIB_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0)
    

    I suggest you copy this module in your /cmake/ directory. And, then use a find_package in your root CMakeLists.txt file.

    0 讨论(0)
提交回复
热议问题