Skip to content

Commit 098c57c

Browse files
committed
Use $<CONFIG> to specify build type with all generators + restore 'u' build type
1 parent b4b0188 commit 098c57c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

cmake/BsoncxxUtil.cmake

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,9 @@ function(bsoncxx_add_library TARGET OUTPUT_NAME LINK_TYPE)
3434
# Build type:
3535
# - 'd' for debug.
3636
# - 'r' for release (including RelWithDebInfo and MinSizeRel).
37-
if(1)
38-
if(isMultiConfig)
39-
set(build_type $<IF:$<CONFIG:Debug>,d,$<IF:$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>,r,u>>)
40-
else()
41-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
42-
set(build_type "d")
43-
elseif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
44-
set(build_type "r")
45-
else()
46-
message(FATAL_ERROR "could not determine build type: must be one of [dr]")
47-
endif()
48-
endif()
49-
37+
# - 'u' for unknown (e.g. to allow user-defined configurations).
38+
set(build_type $<IF:$<CONFIG:Debug>,d,$<IF:$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>,r,u>>)
5039
set_target_properties(${TARGET} PROPERTIES INTERFACE_BSONCXX_ABI_TAG_BUILD_TYPE ${build_type})
51-
5240
string(APPEND abi_tag "-${build_type}")
5341
endif()
5442

0 commit comments

Comments
 (0)