Skip to content

Commit 8a4bca8

Browse files
authored
fix(cmake): use case-insensitive CMAKE_BUILD_TYPE comparisons (#4078)
1 parent 29f4940 commit 8a4bca8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tools/pybind11NewTools.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ function(pybind11_add_module target_name)
233233
endif()
234234
endif()
235235

236-
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
236+
# Use case-insensitive comparison to match the result of $<CONFIG:cfgs>
237+
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
238+
if(NOT MSVC AND NOT ${uppercase_CMAKE_BUILD_TYPE} MATCHES DEBUG|RELWITHDEBINFO)
237239
# Strip unnecessary sections of the binary on Linux/macOS
238240
pybind11_strip(${target_name})
239241
endif()

tools/pybind11Tools.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ function(pybind11_add_module target_name)
208208
endif()
209209
endif()
210210

211-
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
211+
# Use case-insensitive comparison to match the result of $<CONFIG:cfgs>
212+
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
213+
if(NOT MSVC AND NOT ${uppercase_CMAKE_BUILD_TYPE} MATCHES DEBUG|RELWITHDEBINFO)
212214
pybind11_strip(${target_name})
213215
endif()
214216

0 commit comments

Comments
 (0)