From 7b4e8e5f61e18bfc3ce76640072bf72ce9b1c4e3 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Wed, 1 Jun 2022 08:47:39 +0200 Subject: [PATCH] feat: Add CMake project to make sure that headers can be compiled, individually --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ed2c50d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.11) + +project(GTAV-Classes) + +include(CheckIncludeFileCXX) + +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_REQUIRED_QUIET ON) + +set(OK TRUE) + +file(GLOB HEADERS "*.hpp") + +message(STATUS "") + +foreach(HEADER ${HEADERS}) + get_filename_component(FILENAME ${HEADER} NAME) + check_include_file_cxx("${HEADER}" ${FILENAME}_OK) + + if(${FILENAME}_OK) + message(STATUS "${FILENAME} OK!") + else() + set(OK FALSE) + message(SEND_ERROR "${FILENAME} failed to compile!") + endif() +endforeach() + +message(STATUS "") + +if(NOT OK) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeError.log" LOG) + message(STATUS ${LOG}) +endif()