From 6ed7f146c3f81b41faecc7d1d1e6f0330fe32b3a Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Mon, 27 Aug 2018 15:48:57 -0700 Subject: [PATCH] cmake: allow opting out debug runtime (#4317) Summary: Projects built in debug profile don't always link to debug runtime. Allowing opting out the debug runtime to make rocksdb get along well with other projects. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4317 Differential Revision: D9518038 Pulled By: sagar0 fbshipit-source-id: 384901a0d12b8de20759756e8a19b4888a27c399 --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56b66a661..6ba602ea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,12 +336,18 @@ endif() # Used to run CI build and tests so we can run faster option(OPTDBG "Build optimized debug build with MSVC" OFF) +option(WITH_RUNTIME_DEBUG "build with debug version of runtime library" ON) if(MSVC) if(OPTDBG) message(STATUS "Debug optimization is enabled") - set(CMAKE_CXX_FLAGS_DEBUG "/Oxt /${RUNTIME_LIBRARY}d") + set(CMAKE_CXX_FLAGS_DEBUG "/Oxt") else() - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /RTC1 /Gm /${RUNTIME_LIBRARY}d") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /RTC1 /Gm") + endif() + if(WITH_RUNTIME_DEBUG) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /${RUNTIME_LIBRARY}d") + else() + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /${RUNTIME_LIBRARY}") endif() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oxt /Zp8 /Gm- /Gy /${RUNTIME_LIBRARY}") -- GitLab