30 lines
714 B
CMake
30 lines
714 B
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(Transmission)
|
|
|
|
if(NOT DEFINED TARGET_SYSTEM_NAME)
|
|
set(TARGET_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
|
|
message("使用默认目标 : ${TARGET_SYSTEM_NAME}")
|
|
endif ()
|
|
if (${TARGET_SYSTEM_NAME} STREQUAL "Linux")
|
|
add_definitions(-DBUILD_LINUX=1)
|
|
message("以Linux为构建目标")
|
|
elseif (${TARGET_SYSTEM_NAME} STREQUAL "Windows")
|
|
add_definitions(-DBUILD_WINDOWS=1)
|
|
message("以Windows为构建目标")
|
|
else ()
|
|
message(FATAL_ERROR "未知的目标操作系统")
|
|
endif ()
|
|
|
|
add_subdirectory(src)
|
|
if (IS_TEST)
|
|
add_subdirectory(test)
|
|
message("包含Gtest目标")
|
|
endif ()
|
|
|
|
add_executable(exec main.cpp
|
|
)
|
|
|
|
target_link_libraries(exec Transmission)
|
|
|
|
|