2023-10-31 06:07:03 +03:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2023-11-25 20:55:57 +03:00
|
|
|
project(csnake VERSION 1.1 LANGUAGES C)
|
2023-10-31 06:07:03 +03:00
|
|
|
|
|
|
|
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
|
|
|
message(FATAL_ERROR "In-source builds are not allowed.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(csnake
|
|
|
|
src/main.c
|
|
|
|
src/screen.c
|
|
|
|
src/input.c
|
|
|
|
src/player.c
|
2023-11-25 13:24:01 +03:00
|
|
|
src/sleep.c
|
2023-10-31 06:07:03 +03:00
|
|
|
)
|
|
|
|
|
2023-11-25 20:27:09 +03:00
|
|
|
set_target_properties(csnake PROPERTIES C_STANDARD 11)
|
2023-10-31 06:07:03 +03:00
|
|
|
set_target_properties(csnake PROPERTIES C_EXTENSIONS FALSE)
|
2023-11-25 20:55:57 +03:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
|
|
target_link_libraries(csnake pthread)
|
|
|
|
endif()
|
2023-10-31 06:07:03 +03:00
|
|
|
target_include_directories(csnake PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
|
|
|
set(SIZE 10 CACHE STRING "Size of game field")
|
|
|
|
set(DEFX 0 CACHE STRING "Start x")
|
|
|
|
set(DEFY 0 CACHE STRING "Start y")
|
|
|
|
|
|
|
|
configure_file(include/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h)
|