September 2018
Intermediate to advanced
606 pages
14h 32m
English
We will start out with the following CMake project:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)project(recipe-06 LANGUAGES NONE)macro(custom_include_guard) if(NOT DEFINED included_modules) set(included_modules) endif() if ("${CMAKE_CURRENT_LIST_FILE}" IN_LIST included_modules) message(WARNING "module ${CMAKE_CURRENT_LIST_FILE} processed more than once") endif() list(APPEND included_modules ${CMAKE_CURRENT_LIST_FILE})endmacro()include(cmake/custom.cmake)message(STATUS "list of all included modules: ${included_modules}")
This code defines a custom include guard, includes a custom module (the same module as in the previous recipe), and prints the list of all included modules. For CMake 3.10 and higher, we now know from the ...
Read now
Unlock full access