[vtk-developers] C++11 compiler flags not set.

Shawn Waldon shawn.waldon at kitware.com
Fri May 27 11:52:07 EDT 2016


Hi Geoff,

The compile option is set by default by the CXX_STANDARD_REQUIRED property
of the target.  If we set the CMAKE_CXX_STANDARD_REQUIRED, then this sets
the default value of that for all targets.  This avoids having to manually
set the standard on each target.  This is the approach taken by Steven's
merge request and the way that option was supposed to work.

Steven,

I missed the merge request before, but I'll try it out later and merge it.
Thanks for contributing and I'm sorry it took so long to review it.

Shawn

On Fri, May 27, 2016 at 11:43 AM, Geoff Wright <gpwright at gmail.com> wrote:

> Hi all,
>
> I have also ran into this issue but my understanding is that its more
> appropriate to use target_compile_options rather than directly modifying
> CXX_FLAGS because the latter can cause issues when trying to make debug
> builds, depending on how that is being done.  I added this in
> vtkModuleMacros.cmake, which works well:
>
> # Enable C++11 compiler features if requested
> if (VTK_USE_CXX11_FEATURES)
>     target_compile_options(${vtk-module} INTERFACE -std=c++11)
>  endif()
>
>
> G
>
>
>
> On Fri, May 27, 2016 at 11:26 AM Hahn, Steven E. <hahnse at ornl.gov> wrote:
>
>> I ran into this issue a few months ago and submitted a merge request with
>> changes to set the CXX_FLAGS automatically when VTK_USE_CXX11_FEATURES is
>> set.
>>
>> https://gitlab.kitware.com/vtk/vtk/merge_requests/1314
>>
>>
>>
>> Best,
>>
>> Steven
>>
>>
>>
>> *From: *vtk-developers <vtk-developers-bounces at vtk.org> on behalf of
>> Shawn Waldon <shawn.waldon at kitware.com>
>> *Date: *Friday, May 27, 2016 at 8:42 AM
>> *To: *"andrew.amaclean at gmail.com" <andrew.amaclean at gmail.com>
>> *Cc: *VTK Developers <vtk-developers at vtk.org>
>> *Subject: *Re: [vtk-developers] C++11 compiler flags not set.
>>
>>
>>
>> Hi Andrew,
>>
>> That looks like it is probably a bug in the CMake code for
>> VTK_USE_CXX11_FEATURES.  I added that flag... I'll take a look at it this
>> weekend.
>>
>> Shawn
>>
>>
>>
>> On Fri, May 27, 2016 at 1:42 AM, Andrew Maclean <
>> andrew.amaclean at gmail.com> wrote:
>>
>> Has anyone else noticed this issue?
>>
>>
>>
>> Currently when building the master, I am getting many warnings along
>> these lines:
>>
>> "warning: override controls (override/final) only available with
>> -std=c++11 or -std=gnu++11
>>
>>    void UnRegister(vtkObjectBase* o) VTK_OVERRIDE;"
>>
>>
>>
>> It seems VTK_USE_CXX11_FEATURES is not setting the compiler flags for
>> C++11.
>>
>> The evidence for this is that I get a clean build when manually adding
>> -std=c++11 to CXXFLAGS.
>>
>> Once this is done the only warnings are those about auto_ptr being
>> deprecated.
>>
>>
>>
>> I thought the role of VTK_USE_CXX11_FEATURES was to set up the compiler
>> to use c++11 features making it unnecessary to add it in CXXFLAGS.
>>
>>
>>
>> I'm building on Ubuntu 16.04, gcc 5.3.1 using the latest master.
>>
>>
>>
>> Regards
>>
>>    Andrew
>>
>>
>> --
>>
>> ___________________________________________
>> Andrew J. P. Maclean
>>
>> ___________________________________________
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160527/3e4b9713/attachment.html>


More information about the vtk-developers mailing list