improved cmake: more modern target-based style

This commit is contained in:
璀境石 2023-08-24 10:20:18 +08:00
parent 04cf767f17
commit 9207a3ea8e
2 changed files with 8 additions and 5 deletions

View File

@ -32,5 +32,4 @@ option(D3D12MA_BUILD_SAMPLE "Build D3D12MemoryAllocator sample application" OFF)
message(STATUS "D3D12MA_BUILD_SAMPLE = ${D3D12MA_BUILD_SAMPLE}") message(STATUS "D3D12MA_BUILD_SAMPLE = ${D3D12MA_BUILD_SAMPLE}")
include_directories(include)
add_subdirectory(src) add_subdirectory(src)

View File

@ -7,10 +7,6 @@ if(WIN32 AND ${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(D3D12MA_LIBRARY_SOURCE_FILES ${D3D12MA_LIBRARY_SOURCE_FILES} D3D12MemAlloc.natvis) set(D3D12MA_LIBRARY_SOURCE_FILES ${D3D12MA_LIBRARY_SOURCE_FILES} D3D12MemAlloc.natvis)
endif() endif()
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_RELWITHDEBINFO_POSTFIX rd)
set(CMAKE_MINSIZEREL_POSTFIX s)
add_library(D3D12MemoryAllocator ${D3D12MA_LIBRARY_SOURCE_FILES}) add_library(D3D12MemoryAllocator ${D3D12MA_LIBRARY_SOURCE_FILES})
set_target_properties( set_target_properties(
@ -22,6 +18,14 @@ set_target_properties(
CXX_STANDARD_REQUIRED ON CXX_STANDARD_REQUIRED ON
OUTPUT_NAME "D3D12MA" OUTPUT_NAME "D3D12MA"
# Postfix for different profiles
DEBUG_POSTFIX "d"
RELWITHDEBINFO_POSTFIX "rd"
MINSIZEREL_POSTFIX "s"
)
target_include_directories(D3D12MemoryAllocator PUBLIC
"${PROJECT_SOURCE_DIR}/include"
) )
target_link_libraries(D3D12MemoryAllocator PUBLIC target_link_libraries(D3D12MemoryAllocator PUBLIC