Date: Mon, 6 Feb 2017 23:53:29 +0100 From: Michael Gmelin <freebsd@grem.de> To: Raphael Kubo da Costa <rakuco@FreeBSD.org> Cc: "freebsd-ports\@freebsd.org" <freebsd-ports@freebsd.org> Subject: Re: cmake release builds don't disable assertions (NDEBUG) Message-ID: <20170206235329.2952f667@bsd64.grem.de> In-Reply-To: <86wpd3t3h6.fsf@orwell> References: <20170206180539.43e98408@bsd64.grem.de> <86wpd3t3h6.fsf@orwell>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 06 Feb 2017 22:27:01 +0100 Raphael Kubo da Costa <rakuco@FreeBSD.org> wrote: > Michael Gmelin <freebsd@grem.de> writes: > > > While debugging an unexpected assertion problem, I noticed that > > ports using cmake don't set -NDEBUG, even when building in Release > > mode. > > > > Is this intentional? > > Is it the software you're porting that checks for DEBUG or some > library it uses? > > CMake code should check for CMAKE_BUILD_TYPE and adjust the compiler > flags accordingly (if at all); so if the software itself is checking > for DEBUG but not passing (or omitting it) I'd say the bug is there, > not in Mk/Uses/cmake.mk. Well, cmake.mk overwrites the meaning of CMAKE_CXX_FLAGS_RELEASE with the content of CXXFLAGS, are you sure that doing this is the right thing to do? I sampled a couple of smaller projects that use cmake in the ports tree and it seems like many projects don't do anything special to prevent assertions or debug code when built using CMAKE_BUILD_TYPE=Release, which makes me think that the authors depend on the default behaviour of cmake, which includes "-NDEBUG" in Release mode (AFAIK default flags for build types are also compiler and platform dependent, so it kind of makes sense to rely on the defaults, doesn't it?). Thanks, -m -- Michael Gmelin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170206235329.2952f667>