Our include_guard macro contains two branches, one for CMake below 3.10 and one for CMake 3.10 and higher:
macro(include_guard) if (CMAKE_VERSION VERSION_LESS "3.10") # ... else() # ... endif()endmacro()
If CMake version is below 3.10, we enter the first branch and an intrinsic include_guard is not available, so we define our own:
message(STATUS "calling our custom include_guard")# if this macro is called the first time# we start with an empty listif(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})
If the macro is called ...