[Cmake] file/project specific compile flags

Phil Pritchett p.pritchett at 2d3.com
Mon Oct 29 09:25:00 EST 2001


I think it does need to be a something that CMake deals with. In one build I
need to compile this one library with size optimization, and in other builds
I need to compile it with speed optimization.

Phil 

-----Original Message-----
From: Miller, James V (CRD) [mailto:millerjv at crd.ge.com]
Sent: Monday, October 29, 2001 1:39 PM
To: Phil Pritchett; 'William A. Hoffman'
Cc: Cmake Mailing List (E-mail); VXL Mailing List (E-mail)
Subject: RE: [Cmake] file/project specific compile flags


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/v3
p/netlib/slamch.c.diff?r1=1.1&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]
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]
> 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

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.



More information about the CMake mailing list