[Rock-dev] using c++11 CMAKE_CXX_FLAGS

Matthias Goldhoorn matthias.goldhoorn at dfki.de
Fri Feb 20 16:21:08 CET 2015


I would like to restart the discussion regarding adding C++11 Features 
to Rock.

I created a PR on rock.cmake for enabling cxx11 support:

https://github.com/rock-core/base-cmake/pull/11

This would simplify the activation of cxx11 support for rock packages 
like by setting in your overrides.rb:

Autoproj.post_import do |pkg|
     if pkg.kind_of?(Autobuild::CMake)
         pkg.define "ROCK_USE_CXX11", "TRUE"
     end
end

There might be drawbacks as mentioned in:

https://github.com/rock-planning/planning-pddl_planner/pull/1

And this enabled CXX11 only for rock cmake packages that using the 
rock-cmake macros.

But nevertheless, for my installation is seems to work without any major 
problems (some minor compilation errors that can be  fixed easily)

Thoughts?

Best,
Matthias



On 08.12.2014 12:33, Martin Zenzes wrote:
> On 12/08/2014 11:51 AM, Leif Christensen wrote:
>> Hi,
>>
>> I was wondering, if using the c++11 standard in my lib (perhaps later
>> using base-types) would break any Rock stuff? Couldn't image how, but
>> just to be sure.
>>
>> Using it like this in my CMakeLists.txt
>>> list(APPEND CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
> I never used this idiom. But as stated here [1]:
>
>   > If you specify any CMAKE_CXX_FLAGS from the command line, the second
> method will produce a semicolon in the build command (and repeat the
> original CMAKE_CXX_FLAGS twice)
>
> The following solution is suggested here [2]:
>
>   > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
>
> Most of the time I use "add_definitions()" for flags like these, which
> works most of the time but is actually "wrong"...
>
> [1]
> https://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake#comment24241515_10852679
> [2] http://stackoverflow.com/a/20826165/3520187
>
> Martin
>


-- 
  Dipl.-Inf. Matthias Goldhoorn
  Space and Underwater Robotic

  Universität Bremen
  FB 3 - Mathematik und Informatik
  AG Robotik
  Robert-Hooke-Straße 1
  28359 Bremen, Germany
  
  Zentrale: +49 421 178 45-6611
  
  Besuchsadresse der Nebengeschäftstelle:
  Robert-Hooke-Straße 5
  28359 Bremen, Germany
  
  Tel.:    +49 421 178 45-4193
  Empfang: +49 421 178 45-6600
  Fax:     +49 421 178 45-4150
  E-Mail:  matthias.goldhoorn at informatik.uni-bremen.de

  Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



More information about the Rock-dev mailing list