Lines Matching +full:pkg +full:- +full:config

3 GoogleTest comes with pkg-config files that can be used to determine all
5 Pkg-config is a standardised plain-text format containing
7 * the includedir (-I) path
8 * necessary macro (-D) definitions
9 * further required flags (-pthread)
10 * the library (-L) path
11 * the library (-l) to link to
13 All current build systems support pkg-config in one way or another. For all
19 Using `pkg-config` in CMake is fairly easy:
40 just -I flags (GoogleTest might require a macro indicating to internal headers
42 GoogleTest might also require `-pthread` in the compiling step, and as such
43 splitting the pkg-config `Cflags` variable into include dirs and macros for
46 to discard `-L` flags and `-pthread`.
48 ### Help! pkg-config can't find GoogleTest!
55 -- Checking for one of the modules 'gtest_main'
62 pkg-config where it can find the `.pc` files containing the information. Say you
70 pkg-config will also try to look in `PKG_CONFIG_PATH` to find `gtest_main.pc`.
72 ### Using pkg-config in a cross-compilation setting
74 Pkg-config can be used in a cross-compilation setting too. To do this, let's
75 assume the final prefix of the cross-compiled installation will be `/usr`, and
79 mkdir build && cmake -DCMAKE_INSTALL_PREFIX=/usr ..
85 make -j install DESTDIR=/home/MYUSER/sysroot
89 variables for pkg-config in a cross-compilation setting:
96 otherwise `pkg-config` will filter `-I` and `-L` flags against standard prefixes
100 If you look at the generated pkg-config file, it will look something like
110 Libs: -L${libdir} -lgtest -lpthread
111 Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -lpthread
115 to run `pkg-config` with the correct
120 $ pkg-config --cflags gtest
121 -DGTEST_HAS_PTHREAD=1 -lpthread -I/usr/include
122 $ pkg-config --libs gtest
123 -L/usr/lib64 -lgtest -lpthread
127 order to use this in a cross-compilation setting, we need to tell pkg-config to
128 inject the actual sysroot into `-I` and `-L` variables. Let us now tell
129 pkg-config about the actual sysroot
137 and running `pkg-config` again we get
140 $ pkg-config --cflags gtest
141 -DGTEST_HAS_PTHREAD=1 -lpthread -I/home/MYUSER/sysroot/usr/include
142 $ pkg-config --libs gtest
143 -L/home/MYUSER/sysroot/usr/lib64 -lgtest -lpthread
148 Elio Pettenò: <https://autotools.io/pkgconfig/cross-compiling.html>