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 模式下的配置