From ef0798dc044dbaabe05fa79125899a25f3f6c614 Mon Sep 17 00:00:00 2001 From: DevWiki Date: Thu, 26 Sep 2024 15:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=BE=93=E5=87=BA=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinDevice/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/WinDevice/CMakeLists.txt b/WinDevice/CMakeLists.txt index 6840619..37aaf23 100644 --- a/WinDevice/CMakeLists.txt +++ b/WinDevice/CMakeLists.txt @@ -12,6 +12,14 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) # 设置Windows相关配置 set(CMAKE_GENERATOR_TOOLSET "v142") +if (NOT DEFINED CMAKE_GENERATOR_PLATFORM) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CMAKE_GENERATOR_PLATFORM x64) + else() + set(CMAKE_GENERATOR_PLATFORM x86) + endif() +endif() + # 设置C++标准 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -79,6 +87,15 @@ target_link_libraries(WinDevice PRIVATE ${DirectX_LIBS}) # 创建 output 目录 set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/output) file(MAKE_DIRECTORY ${OUTPUT_DIR}) +set_target_properties(WinDevice PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" + LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" + + ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" + LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" + ) if (CMAKE_BUILD_TYPE STREQUAL "Debug") # Debug 模式下的配置