Skip to content

Commit

Permalink
Fix #1524
Browse files Browse the repository at this point in the history
Xcode is a multi-config generator that may not define `NDEBUG` if
`CMAKE_BUILD_TYPE` is unset and the project is built in Release or
RelWithDebInfo via `cmake --build`. Therefore, be sure to define
`NDEBUG` if it's a non-debug config. Also, simplify the define for
`_DEBUG`. It's OK to double-define something.
  • Loading branch information
Hoikas committed Nov 11, 2023
1 parent e7af4c6 commit 65c8b9e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmake/FindPhysX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,9 @@ macro(_find_physx_library SUFFIX)

# The PhysX headers require that either _DEBUG or NDEBUG is always
# defined (but not both at once), otherwise they produce an error.
# For release builds, NDEBUG is always automatically defined
# (either by CMake and/or the compilers).
# For debug builds, _DEBUG is automatically defined by MSVC,
# but for other compilers we need to define it ourselves.
target_compile_definitions(${TARGET} INTERFACE
$<$<AND:$<CONFIG:Debug>,$<NOT:$<CXX_COMPILER_ID:MSVC>>>:_DEBUG>
$<$<CONFIG:Debug>:_DEBUG>
$<$<NOT:$<CONFIG:Debug>>:NDEBUG>
)
endif()

Expand Down

0 comments on commit 65c8b9e

Please sign in to comment.