> From: Stuart Henderson <st...@openbsd.org>
> Date: Mon, Oct 20, 2014 at 7:54 PM
> Subject: Re: CMAKE_BUILD_TYPE=Release by default (Was CVS:
> cvs.openbsd.org: ports)
> To: David Coppa <dco...@gmail.com>
> Cc: OpenBSD Ports <ports@openbsd.org>, Vadim Zhukov
> <z...@openbsd.org>, Antoine Jacoutot <ajacou...@openbsd.org>
> 
> 
> On 2014/10/20 19:42, David Coppa wrote:
> > On Mon, Oct 20, 2014 at 5:57 PM, Antoine Jacoutot
> > <ajacou...@cvs.openbsd.org> wrote:
> > > CVSROOT:        /cvs
> > > Module name:    ports
> > > Changes by:     ajacou...@cvs.openbsd.org       2014/10/20 09:57:12
> > >
> > > Modified files:
> > >         x11/polkit-qt4 : Makefile
> > >         x11/polkit-qt4/pkg: PLIST
> > >         productivity/libqzeitgeist: Makefile
> > >         productivity/libqzeitgeist/pkg: PLIST
> > >
> > > Log message:
> > > Pass -DCMAKE_BUILD_TYPE=Release to have a proper release.cmake file 
> > > instead
> > > of the noconfig one.
> > >
> > > I wonder if at one point this should go into the cmake MODULE as a 
> > > default...
> >
> > Some days ago, I was going to mail ports@ suggesting exactly this.
> >
> > Would you give your ok?
> 
> Would it make sense to only set this if no other -DCMAKE_BUILD_TYPE is set?
> (Otherwise it would be more awkward to do a -DCMAKE_BUILD_TYPE=Debug build for
> a single port).

This is what FreeBSD did:

---8<---

Index: cmake.port.mk
===================================================================
RCS file: /cvs/ports/devel/cmake/cmake.port.mk,v
retrieving revision 1.32
diff -u -p -u -p -r1.32 cmake.port.mk
--- cmake.port.mk       7 Oct 2014 11:12:23 -0000       1.32
+++ cmake.port.mk       21 Oct 2014 10:41:15 -0000
@@ -75,6 +75,12 @@ MODCMAKE_configure=  cd ${WRKBUILD} && ${
                -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY:Bool=True \
                -G ${_MODCMAKE_GEN} ${CONFIGURE_ARGS} ${WRKSRC}
 
+.if defined(DEBUG)
+CONFIGURE_ARGS += -DCMAKE_BUILD_TYPE:String=Debug
+.else
+CONFIGURE_ARGS += -DCMAKE_BUILD_TYPE:String=Release
+.endif
+
 SEPARATE_BUILD ?=      Yes
 
 TEST_TARGET ?= test

---8<---

If this is not good enough, I think I'd need to patch the code so
it falls back to "Release" if CMAKE_BUILD_TYPE is empty.

Ciao,
David

Reply via email to