设置输出目录

This commit is contained in:
DevWiki 2024-09-26 15:40:34 +08:00
parent 8fd78ae625
commit ef0798dc04

View File

@ -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