2024-02-19 20:44:33 -05:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
|
|
|
|
2024-02-22 19:00:48 -05:00
|
|
|
project(Chess C CXX)
|
2024-02-19 20:44:33 -05:00
|
|
|
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
2024-09-15 18:13:56 -04:00
|
|
|
file(GLOB_RECURSE cpp_sources
|
2024-02-22 19:00:48 -05:00
|
|
|
CONFIGURE_DEPENDS
|
2024-09-14 09:40:43 -04:00
|
|
|
"src/*.cpp")
|
|
|
|
|
2024-09-15 18:13:56 -04:00
|
|
|
file(GLOB_RECURSE c_sources
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
"src/*.c")
|
|
|
|
|
2024-09-14 09:40:43 -04:00
|
|
|
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()
|
2024-02-19 20:44:33 -05:00
|
|
|
|
2024-09-15 18:13:56 -04:00
|
|
|
add_executable(Chess ${cpp_sources} ${c_sources})
|
2024-02-22 19:00:48 -05:00
|
|
|
set_target_properties(Chess PROPERTIES CXX_STANDARD 17) # set standard level
|
2024-09-14 09:40:43 -04:00
|
|
|
target_include_directories(Chess PRIVATE ${include_dirs})
|
2024-02-22 19:00:48 -05:00
|
|
|
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)
|