Mk/Uses/cmake.mk: Define -DNDEBUG when BUILD_TYPE is set to RELEASE

CMake defines -DNDEBUG when BUILD_TYPE is set to RELEASE by default
however default flags gets dropped when CMAKE_C_FLAGS_RELEASE and
CMAKE_CXX_FLAGS_RELEASE are (re)defined. This causes some projects
to build with debugging by default which needs to be disabled
by hand if they do not set -DNDEBUG manually either in ports
Makefile and/or in CMake's Makefile. To follow upstream add
-DNDEBUG to our RELEASE flags.

PR:		266721
Reviewed by:	arrowd
Approved by:	portmgr (tcberner)
Differential Revision:	https://reviews.freebsd.org/D36695
Exp-run by:	antoine
This commit is contained in:
Daniel Engberg 2022-10-29 21:27:02 +02:00
parent 68f60fd8f5
commit 3c5189a0fd

View file

@ -79,10 +79,10 @@ CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \
-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
-DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \
-DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS}" \
-DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS} -DNDEBUG" \
-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
-DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS}" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS} -DNDEBUG" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \