cmake_minimum_required(VERSION 3.8) project(Chess C CXX) find_package(SDL2 REQUIRED) file(GLOB_RECURSE cpp_sources CONFIGURE_DEPENDS "src/*.cpp") file(GLOB_RECURSE c_sources CONFIGURE_DEPENDS "src/*.c") file (GLOB_RECURSE headers CONFIGURE_DEPENDS "src/*.h") set (include_dirs "") foreach (_headerFile ${headers}) get_filename_component(_dir ${_headerFile} PATH) list (APPEND include_dirs ${_dir}) endforeach() add_executable(Chess ${cpp_sources} ${c_sources}) set_target_properties(Chess PROPERTIES CXX_STANDARD 17) # set standard level target_include_directories(Chess PRIVATE ${include_dirs}) target_compile_options(Chess PRIVATE -Wall -Wextra -Wredundant-decls -Wcast-align -Wshadow -Wnon-virtual-dtor -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wmisleading-indentation -Wnull-dereference -Wformat=2 ) target_link_libraries(Chess SDL2::SDL2)