Skip to content

Instantly share code, notes, and snippets.

@doccaico
Created June 10, 2025 05:29
Show Gist options
  • Select an option

  • Save doccaico/ba6076283b50201aba10924fa683f280 to your computer and use it in GitHub Desktop.

Select an option

Save doccaico/ba6076283b50201aba10924fa683f280 to your computer and use it in GitHub Desktop.
STC + RAYLIB (Windows ONLY - CMAKE)
cmake_minimum_required(VERSION 3.10)
project(lifegame C)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_C_EXTENSIONS OFF)
file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/src/*.c)
add_executable(${PROJECT_NAME} ${SOURCES})
if (MSVC)
set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
target_compile_features(${PROJECT_NAME} PRIVATE c_std_11)
target_compile_options(${PROJECT_NAME} PRIVATE
/utf-8 -Oi -fp:precise -MP -FC -GF)
target_compile_options(${PROJECT_NAME} PRIVATE
-W4 -WX -wd4100 -wd4101 -wd4127 -wd4146 -wd4505 -wd4456 -wd4457)
target_compile_definitions(${PROJECT_NAME} PRIVATE
-DUNICODE -D_UNICODE)
# Release
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>: -O2 -MT>)
target_compile_definitions(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:NDEBUG _NDEBUG>)
# Debug
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>: -Od -MDd>)
target_compile_definitions(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:DEBUG _DEBUG>)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/vendor/stc/include
${CMAKE_SOURCE_DIR}/vendor/raylib/include)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment