[Cmake] file/project specific compile flags
Miller, James V (CRD)
millerjv at crd . ge . com
Mon, 29 Oct 2001 08:38:53 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1607F.0D1900A0
Content-Type: text/plain
Does this need to be a CMake-ism? I have put "pragmas" in part of the version of vnl that we are
using for the Insight to turn off certain optimization for some routines. For these routines, if /O2
was used, the routines would get into an infinite loop. I ended up turning off "global
optimizations" for a few routines.
Here is an example from vxl/v3p/netlib/slamch.c
/* JVM - Turned off global optimizations for this routine on VC++. If this
routine is optimized, an infinite loop results. */
#if defined(_MSC_VER)
#pragma optimize("g", off)
#endif
/* Subroutine */ int slamc1_(integer *beta, integer *t, logical *rnd, logical
*ieee1)
....
Here's a link the cvs diff page:
http://public . kitware . com/cgi-bin/itkcvsweb . cgi/Insight/Code/Numerics/vxl/v3p/netlib/slamch . c . diff?r1
=1.1
<http://public . kitware . com/cgi-bin/itkcvsweb . cgi/Insight/Code/Numerics/vxl/v3p/netlib/slamch . c . diff?r
1=1.1&r2=1.2&cvsroot=Insight&sortby=date&f=H&f=h> &r2=1.2&cvsroot=Insight&sortby=date&f=H&f=h
I am assuming that if you are switching optimization levels it is because certain optimization levels
produce bad code.
-----Original Message-----
From: Phil Pritchett [ mailto:p . pritchett at 2d3 . com <mailto:p . pritchett at 2d3 . com> ]
Sent: Friday, October 26, 2001 9:35 AM
To: 'William A. Hoffman'
Cc: Cmake Mailing List (E-mail); VXL Mailing List (E-mail)
Subject: RE: [Cmake] file/project specific compile flags
> -----Original Message-----
> From: William A. Hoffman [ mailto:bill . hoffman at kitware . com <mailto:bill . hoffman at kitware . com> ]
> Sent: Friday, October 26, 2001 2:03 PM
> To: Phil Pritchett
> Cc: Cmake Mailing List (E-mail); VXL Mailing List (E-mail)
> Subject: Re: [Cmake] file/project specific compile flags
>
>
> Right now you can not add flags per file, however, you can
> add flags per
> directory.
> You can use the SET command to override a cache value
> Put this in the list file for the one that needs O1:
> SET(CMAKE_CXX_FLAGS -O1)
This won't work for me as it is setting the optimisation for that project to
O1 in all build types whereas I need it set for a specific build type (which
won't have a corresponding CMAKE_CXX_FLAG_MYBUILD). I guess one solution
would be to create a new set of project files and alter the cache to get the
build options I need
IF(MYWEIRDBUILD)
SET(CMAKE_CXX_FLAGS -01)
ENDIF(MYWEIRDBUILD)
where MYWEIRDBUILD gets defined (or not) in the cache.
I'd much rather use the build type to do this sort of thing though.
Phil
This e-mail, and any attachment, is confidential. If you have received it in
error, please delete it from your system, do not use or disclose the
information in any way, and notify me immediately.
_______________________________________________
Cmake mailing list
Cmake at public . kitware . com
http://public . kitware . com/mailman/listinfo/cmake <http://public . kitware . com/mailman/listinfo/cmake>
------_=_NextPart_001_01C1607F.0D1900A0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE></TITLE>
<META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR></HEAD>
<BODY>
<P><FONT size=3D2>Does this need to be a CMake-ism? I have put =
"pragmas" in=20
part of the version of vnl that we are using for the Insight to turn =
off certain=20
optimization for some routines. For these routines, if /O2 was used, =
the=20
routines would get into an infinite loop. I ended up turning off =
"global=20
optimizations" for a few routines.</FONT></P>
<P><FONT color=3D#0000ff size=3D2>Here is an example from=20
vxl/v3p/netlib/slamch.c</FONT></P>
<P>/* JVM - Turned off global optimizations for this routine on VC++. =
If=20
this<BR> routine is optimized, an infinite loop results. =
*/<BR>#if=20
defined(_MSC_VER)<BR>#pragma optimize("g", off)<BR>#endif<BR><BR>/* =
Subroutine=20
*/ int slamc1_(integer *beta, integer *t, logical *rnd, logical<BR> =
=20
*ieee1)<BR><FONT color=3D#0000ff =
size=3D2>....</FONT></P>
<P><FONT color=3D#0000ff size=3D2>Here's a link the cvs diff page: =
</FONT></P>
<P><FONT color=3D#0000ff size=3D2><A=20
href=3D"http://public . kitware . com/cgi-bin/itkcvsweb . cgi/Insight/Code/Num=
erics/vxl/v3p/netlib/slamch.c.diff?r1=3D1.1&r2=3D1.2&cvsroot=3DI=
nsight&sortby=3Ddate&f=3DH&f=3Dh">http://public . kitware . com/=
cgi-bin/itkcvsweb.cgi/Insight/Code/Numerics/vxl/v3p/netlib/slamch.c.diff=
?r1=3D1.1&r2=3D1.2&cvsroot=3DInsight&sortby=3Ddate&f=3DH=
&f=3Dh</A></FONT></P>
<P><FONT size=3D2>I am assuming that if you are switching optimization =
levels it=20
is because certain optimization levels produce bad code.</FONT></P>
<DIV><FONT size=3D2><FONT color=3D#0000ff></FONT> </DIV>
<P><BR><BR>-----Original Message-----<BR>From: Phil Pritchett [<A=20
href=3D"mailto:p . pritchett at 2d3 . com">mailto:p . pritchett at 2d3 . com</A>]<BR>S=
ent:=20
Friday, October 26, 2001 9:35 AM<BR>To: 'William A. Hoffman'<BR>Cc: =
Cmake=20
Mailing List (E-mail); VXL Mailing List (E-mail)<BR>Subject: RE: =
[Cmake]=20
file/project specific compile flags<BR><BR><BR>> -----Original=20
Message-----<BR>> From: William A. Hoffman [<A=20
href=3D"mailto:bill . hoffman at kitware . com">mailto:bill . hoffman at kitware . com=
</A>]<BR>>=20
Sent: Friday, October 26, 2001 2:03 PM<BR>> To: Phil =
Pritchett<BR>> Cc:=20
Cmake Mailing List (E-mail); VXL Mailing List (E-mail)<BR>> Subject: =
Re:=20
[Cmake] file/project specific compile flags<BR>><BR><BR>><BR>> =
Right=20
now you can not add flags per file, however, you can<BR>> add flags=20
per<BR>> directory.<BR>> You can use the SET command to override =
a cache=20
value<BR>> Put this in the list file for the one that needs =
O1:<BR>>=20
SET(CMAKE_CXX_FLAGS -O1)<BR><BR>This won't work for me as it is setting =
the=20
optimisation for that project to<BR>O1 in all build types whereas I =
need it set=20
for a specific build type (which<BR>won't have a corresponding=20
CMAKE_CXX_FLAG_MYBUILD). I guess one solution<BR>would be to create a =
new set of=20
project files and alter the cache to get the<BR>build options I=20
need<BR>IF(MYWEIRDBUILD)<BR>SET(CMAKE_CXX_FLAGS=20
-01)<BR>ENDIF(MYWEIRDBUILD)<BR>where MYWEIRDBUILD gets defined (or not) =
in the=20
cache.<BR>I'd much rather use the build type to do this sort of thing=20
though.<BR><BR>Phil<BR><BR>This e-mail, and any attachment, is =
confidential. If=20
you have received it in<BR>error, please delete it from your system, do =
not use=20
or disclose the<BR>information in any way, and notify me=20
immediately.<BR>_______________________________________________<BR>Cmake=
mailing=20
list<BR>Cmake at public . kitware . com<BR><A target=3D_blank=20
href=3D"http://public . kitware . com/mailman/listinfo/cmake">http://public . =
kitware.com/mailman/listinfo/cmake</A><BR></P></FONT></BODY></HTML>
------_=_NextPart_001_01C1607F.0D1900A0--