From 9207a3ea8e1ada5c41404038f7fae88cf40430c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=92=80=E5=A2=83=E7=9F=B3?= Date: Thu, 24 Aug 2023 10:20:18 +0800 Subject: [PATCH] improved cmake: more modern target-based style --- CMakeLists.txt | 1 - src/CMakeLists.txt | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f51b781..691ebfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,5 +32,4 @@ option(D3D12MA_BUILD_SAMPLE "Build D3D12MemoryAllocator sample application" OFF) message(STATUS "D3D12MA_BUILD_SAMPLE = ${D3D12MA_BUILD_SAMPLE}") -include_directories(include) add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 668cb64..8161943 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,10 +7,6 @@ if(WIN32 AND ${CMAKE_GENERATOR} MATCHES "Visual Studio.*") set(D3D12MA_LIBRARY_SOURCE_FILES ${D3D12MA_LIBRARY_SOURCE_FILES} D3D12MemAlloc.natvis) endif() -set(CMAKE_DEBUG_POSTFIX d) -set(CMAKE_RELWITHDEBINFO_POSTFIX rd) -set(CMAKE_MINSIZEREL_POSTFIX s) - add_library(D3D12MemoryAllocator ${D3D12MA_LIBRARY_SOURCE_FILES}) set_target_properties( @@ -22,6 +18,14 @@ set_target_properties( CXX_STANDARD_REQUIRED ON 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