[ITK-dev] How to override optimization compile flag?

Lefman, Jonathan jonathan.lefman at intel.com
Mon May 22 17:16:15 EDT 2017


Thank you

-Jon


-----Original Message-----
From: Matt McCormick [mailto:matt.mccormick at kitware.com] 
Sent: Monday, May 22, 2017 5:01 PM
To: Lefman, Jonathan <jonathan.lefman at intel.com>
Cc: insight-developers at itk.org
Subject: Re: [ITK-dev] How to override optimization compile flag?

Hi Jon,

This can be disabled by setting

  CMAKE_BUILD_TYPE

to an empty string. The default is "Release", which adds the -O3 flag.

HTH,
Matt

On Mon, May 22, 2017 at 4:55 PM, Lefman, Jonathan <jonathan.lefman at intel.com> wrote:
> Hi all,
>
>
>
> I am trying to override the -O3 flag using 
> ITK_CXX_DISABLE_OPTIMIZATION_FLAG in 
> ITKSetStandardCompilerFlags.cmake. It is not obvious how this is 
> supposed to work. When I set ITK_CXX_DISABLE_OPTIMIZATION_FLAG in the cmake command or in CMAKE_CXX_FLAGS=’-O0’, the flag is overridden:
>
>
>
> icpc: command line remark #10120: overriding '-O0' with '-O3'
>
>
>
> Example:
>
>
>
> # CMAKE generated file: DO NOT EDIT!
>
> # Generated by "Unix Makefiles" Generator, CMake Version 3.8
>
>
>
> # compile CXX with
> /opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/icpc
>
> CXX_FLAGS =  -O0  -w2 -wd1268 -wd981 -wd383 -wd1418 -wd1419 -wd2259 
> -wd1572
> -wd424 -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch 
> -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-deprecated 
> -Wno-invalid-offsetof -Woverloaded-virtual  -O3 -DNDEBUG –fPIE
>
>
>
> I do see another variable “CXX_HAS_DISABLE_OPTIMIZATION_FLAG” but it 
> is reported as unused by cmake. Please let me know the right way to 
> remove the
> -O3 flag. Thanks very much.
>
>
>
> -Jon
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list