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

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sat, 29 Oct 2022 19:39:32 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3c5189a0fd4c82addfb659024bf28c5006bf88f7

commit 3c5189a0fd4c82addfb659024bf28c5006bf88f7
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2022-10-29 19:27:02 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2022-10-29 19:38:58 +0000

    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
---
 Mk/Uses/cmake.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
index d739cb1e3fdc..bba26ba1c816 100644
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -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}" \