File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -233,11 +233,13 @@ function(pybind11_add_module target_name)
233233 endif ()
234234 endif ()
235235
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)
239- # Strip unnecessary sections of the binary on Linux/macOS
240- pybind11_strip(${target_name} )
236+ if (DEFINED CMAKE_BUILD_TYPE ) # see https://github.com/pybind/pybind11/issues/4454
237+ # Use case-insensitive comparison to match the result of $<CONFIG:cfgs>
238+ string (TOUPPER "${CMAKE_BUILD_TYPE} " uppercase_CMAKE_BUILD_TYPE)
239+ if (NOT MSVC AND NOT "${uppercase_CMAKE_BUILD_TYPE} " MATCHES DEBUG|RELWITHDEBINFO)
240+ # Strip unnecessary sections of the binary on Linux/macOS
241+ pybind11_strip(${target_name} )
242+ endif ()
241243 endif ()
242244
243245 if (MSVC )
Original file line number Diff line number Diff line change @@ -212,10 +212,12 @@ function(pybind11_add_module target_name)
212212 endif ()
213213 endif ()
214214
215- # Use case-insensitive comparison to match the result of $<CONFIG:cfgs>
216- string (TOUPPER "${CMAKE_BUILD_TYPE} " uppercase_CMAKE_BUILD_TYPE)
217- if (NOT MSVC AND NOT "${uppercase_CMAKE_BUILD_TYPE} " MATCHES DEBUG|RELWITHDEBINFO)
218- pybind11_strip(${target_name} )
215+ if (DEFINED CMAKE_BUILD_TYPE ) # see https://github.com/pybind/pybind11/issues/4454
216+ # Use case-insensitive comparison to match the result of $<CONFIG:cfgs>
217+ string (TOUPPER "${CMAKE_BUILD_TYPE} " uppercase_CMAKE_BUILD_TYPE)
218+ if (NOT MSVC AND NOT "${uppercase_CMAKE_BUILD_TYPE} " MATCHES DEBUG|RELWITHDEBINFO)
219+ pybind11_strip(${target_name} )
220+ endif ()
219221 endif ()
220222
221223 if (MSVC )
You can’t perform that action at this time.
0 commit comments