This is a C project and we will use the C99 standard. We will build the CMakeLists.txt file step by step:
- We declare a C project and enforce compliance with the C99 standard:
cmake_minimum_required(VERSION 3.6 FATAL_ERROR) project(recipe-09 LANGUAGES C)set(CMAKE_C_STANDARD 99)set(CMAKE_C_EXTENSIONS OFF)set(CMAKE_C_STANDARD_REQUIRED ON)
- We look for pkg-config, using its find-module shipped with CMake. Notice the QUIET argument passed to find_package. CMake will print messages only if the required pkg-config is not found:
find_package(PkgConfig REQUIRED QUIET)
- When pkg-config is found, we will have access to the pkg_search_module function to search for any library or program that ships a package configuration .pc file. In ...