Files
ExPkg/CMakeLists.txt

33 lines
920 B
CMake
Raw Permalink 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.31)
project(expkg)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# 默认 Release 构建Debug 模式下 GIF/PNG 编码慢 3-5 倍)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
# 第三方依赖
add_subdirectory(vendor/lz4/build/cmake)
# 源文件CONFIGURE_DEPENDS: 文件增删时自动重新配置)
file(GLOB_RECURSE SRC_SOURCE CONFIGURE_DEPENDS src/*.cpp)
file(GLOB STB_SOURCE CONFIGURE_DEPENDS vendor/stb/*.cpp)
# 可执行文件
add_executable(${PROJECT_NAME} ${SRC_SOURCE} ${STB_SOURCE})
# MSVC 默认编码设为 UTF-8
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /utf-8)
endif()
# 依赖与头文件路径
target_link_libraries(${PROJECT_NAME} PRIVATE lz4)
target_include_directories(${PROJECT_NAME}
PRIVATE vendor/stb vendor/gif-h src
)