From: Nathan Moinvaziri Date: Fri, 22 Apr 2022 21:58:24 +0000 (-0700) Subject: Fixed forcing CMAKE_BUILD_TYPE to Release on multi config generators such as Xcode... X-Git-Tag: 2.1.0-beta1~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48e20af11043aa67c9ded8f8da77ffa026e61a59;p=thirdparty%2Fzlib-ng.git Fixed forcing CMAKE_BUILD_TYPE to Release on multi config generators such as Xcode or MSVC. Co-authored-by: Sergey Markelov --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 447d92ac..f0b08808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,13 +59,15 @@ endif() # Make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact # this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel." - FORCE) - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)") -else() - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)") +if(NOT GENERATOR_IS_MULTI_CONFIG) + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel." + FORCE) + add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)") + else() + add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)") + endif() endif() #