Files
tank_battles_on_the_scrap_p…/CMakeLists.txt
T

70 lines
1.6 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
cmake_minimum_required(VERSION 3.10)
project(tank_battles_on_the_scrap_paper
VERSION 1.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ── 源文件 ──
set(SOURCES
tank_battles_on_the_scrap_paper/main.cpp
tank_battles_on_the_scrap_paper/map.cpp
)
set(HEADERS
tank_battles_on_the_scrap_paper/bullet.h
tank_battles_on_the_scrap_paper/tank.h
tank_battles_on_the_scrap_paper/map.h
tank_battles_on_the_scrap_paper/data_config.h
tank_battles_on_the_scrap_paper/resource.h
)
# ── 可执行文件 ──
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}
tank_battles_on_the_scrap_paper/resource.rc
)
# ── Windows 特定配置 ──
if(WIN32)
# EasyX 图形库
target_include_directories(${PROJECT_NAME} PRIVATE
${EASYX_INCLUDE_DIR}
)
# Windows 多媒体库
target_link_libraries(${PROJECT_NAME} PRIVATE
winmm.lib
gdi32.lib
)
# 控制台子系统
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE FALSE
)
target_compile_definitions(${PROJECT_NAME} PRIVATE
_CONSOLE
_UNICODE
UNICODE
)
else()
# 非 Windows 平台给出提示
message(WARNING
"${PROJECT_NAME} 依赖 EasyX (Windows-only 图形库)"
"当前平台不支持编译。仅生成项目结构参考。"
)
endif()
# ── 复制资源文件到构建目录 ──
file(COPY
tank_battles_on_the_scrap_paper/images/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/images/
)
file(COPY
tank_battles_on_the_scrap_paper/music/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/music/
)