← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Enable C++11

 

Hi.

To jp, look at cmake properties CXX_STANDARD, CXX_STANDARD_REQUIRED,
CXX_EXTENSIONS.

[https://cmake.org/cmake/help/v3.4/manual/cmake-properties.7.html](https://lin
k.nylas.com/link/ac7n0u7eu8cj6vjow9ajimqdr/4174df36c5bf4561b73f89e228f5d608/0?
redirect=https%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fv3.4%2Fmanual%2Fcmake-
properties.7.html)

But I don't know is that exist in old cmake version.

  
![](https://link.nylas.com/open/ac7n0u7eu8cj6vjow9ajimqdr/549b31b49a594b0f97f3
4c0d6c1308c1)

> On март 17 2016, at 2:46 дня, jp charras <jp.charras@xxxxxxxxxx>
wrote:  

>

> Le 17/03/2016 10:23, Nick Østergaard a écrit :  
> 2016-03-17 10:15 GMT+01:00 jp charras <jp.charras@xxxxxxxxxx>:  
>> Le 10/03/2016 08:30, Simon Richter a écrit :  
>>>  
>>> This enables C++11 support, if either CMake is sufficiently new
to have  
>>> this feature built in, or the compiler is supported by the
workaround code  
>>> (gcc or clang).  
>>> \---  
>>> CMakeLists.txt | 23 +++++++++++++++++++++++  
>>> 1 file changed, 23 insertions(+)  
>>  
>> After a few tests:  
>>  
>> I can compile Kicad on W7 32 bits + msys2 and Kubuntu 14.04 LTS with
option  
>> -std=gnu++11  
>> and on W7 32 bits (on Kubuntu the compiler version is too old)  
>> -std=gnu++14  
>  
> Is that kubuntu machine updated?

>

> Of course, yes.  
But it uses the gcc 4.9 version, which does not support gnu++14.

>

>  Did it build with -std=c++11 on  
> kubuntu 14.04 LTS?  
>  
>>  
>> but on W7 32 bits the option  
>> -std=c++11  
>> does not work (compil errors)  
>  
> I think I tested Simon's original patch on msys2 on 64 and it seemed  
> to work. What errors do you see?  
>  
>>  
>> Therefore, with gcc:  
>> -std=gnu++11 is OK  
>> -std=c++11 is not acceptable  
>>  
>> (This is not the first time i have issues with option -std=c++11 or  
>> -std=c++14 and no issue with -std=gnu++11 or -std=gnu++14)  
>>  
>>  
>> \--  
>> Jean-Pierre CHARRAS

>

> After more tests:

>

> \- During my first test, I did not applied the patch. I just forced the  
option -std=c++11 when calling cmake.

>

> I had some issues (like M_PI dot defined, although math.h was included,  
and more other issues)

>

> \- After your response, I applied the patch. and I was able to build Kicad.

>

> \- Because this is a bit strange, I had a look at this issue:  
Although there is in this patch the line:  
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")"  
when make is run the actual option (try make VERBOSE=1) is "-std=gnu++11"

>

> So no more mystery, as I wrote:  
-std=gnu++11 works, -std=c++11 does not work.
>

> I am saying "no more mystery", but this is not fully true:  
the option  
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")" becomes actually:  
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")"

>

> And this change is a mystery, at least for me (but I have a poor  
knowledge of cmake).

>

> \--  
Jean-Pierre CHARRAS

>

> _______________________________________________  
Mailing list: https://launchpad.net/~kicad-developers  
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx  
Unsubscribe : https://launchpad.net/~kicad-developers  
More help : https://help.launchpad.net/ListHelp


References