mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-10 06:14:08 +08:00
init the projetc
This commit is contained in:
30
CMakeLists.txt
Normal file
30
CMakeLists.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(SporeBG-Conid)
|
||||
|
||||
# 设置C++标准
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# 设置输出目录
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
|
||||
|
||||
# 包含SDL3子项目
|
||||
add_subdirectory(third_party/SDL3)
|
||||
|
||||
# 添加可执行文件
|
||||
add_executable(SporeBG-Conid src/main.cpp)
|
||||
|
||||
# 使用正确的目标名称链接SDL3
|
||||
# 方法1:使用别名(推荐)
|
||||
target_link_libraries(SporeBG-Conid PRIVATE SDL3::SDL3)
|
||||
|
||||
# Windows下复制动态库 - 使用正确的目标名称
|
||||
if(WIN32)
|
||||
add_custom_command(TARGET SporeBG-Conid POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:SDL3::SDL3>
|
||||
$<TARGET_FILE_DIR:SporeBG-Conid>
|
||||
COMMENT "Copying SDL3 DLL to output directory"
|
||||
)
|
||||
endif()
|
||||
Reference in New Issue
Block a user