From 513ee81fbfc467dee572b12acd91db77ce0ccfb0 Mon Sep 17 00:00:00 2001 From: deflinhec Date: Wed, 29 Apr 2020 22:58:05 +0800 Subject: [PATCH] Make debug postfix optional (#856) Library debug postfix might not be suitable for cross platform project, and usually require extra work of link against prebuilt yaml-cpp. Generally, Xcode project output library to these directories: Debug Release Debug-iphoneos Release-iphoneos Debug-iphonesimulator Release-iphonesimulator Another Xcode project usually configured its build setting as follow, and expects library name to be same between Release and Debug LIBRARY_SEARCH_PATHS=$(CONFIGURATION)$(EFFECT_PLATFORM_NAME) OTHER_LDFLAGS= $(inherited) -lyaml-cpp --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1d2ce0..e03eed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,12 +108,16 @@ target_sources(yaml-cpp PRIVATE $<$:${yaml-cpp-contrib-sources}> ${yaml-cpp-sources}) + +if (NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "d") +endif() set_target_properties(yaml-cpp PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}" - DEBUG_POSTFIX d) + DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") configure_package_config_file( "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"