diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6498ec5..153277d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,11 +19,14 @@ add_library(Transmission CharBuff.cpp Exception/PrepareDataException.h ) - -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +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 (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +elseif (${TARGET_SYSTEM_NAME} STREQUAL "Windows") add_definitions(-DBUILD_WINDOWS=1) message("以Windows为构建目标") else ()