[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] C++11 flag not being added
From: Pau Garcia i Quiles <pgquiles () elpauer ! org>
Date: 2015-10-16 9:26:00
Message-ID: CAKcBoktoR=tAeNKH2V8gUXRA9J0QEo1a+6ObS8b_uYXt+bzD0A () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
CMake 3.3.1 is available from my PPA, in case it helps:
https://launchpad.net/~pgquiles/+archive/ubuntu/ppa
On Fri, Oct 16, 2015 at 10:58 AM, Petr Bena <benapetr@gmail.com> wrote:
> If I did that nearly nobody would be able to compile my program as
> cmake >= 3.1 is extremely rare on most distributions. Even ubuntu's
> PPA builder has some ancient version.
>
> On Fri, Oct 16, 2015 at 9:44 AM, Petr Kmoch <petr.kmoch@gmail.com> wrote:
> > Hi Petr.
> >
> > You're using a feature (`CMAKE_CXX_STANDARD`) introduced in CMake version
> > 3.1, so you should require a minimum version >= that.
> >
> > You can learn the version of CMake by running `cmake --version`
> >
> > Petr
> >
> > On Thu, Oct 15, 2015 at 5:45 PM, Petr Bena <benapetr@gmail.com> wrote:
> >>
> >> What do you mean by "target" property? I don't see any target
> >> mentioned there. I don't have this line in there. I don't know which
> >> CMake this is, it failed on server we use for unit tests, but I have
> >> required min. version set to 2.8.7
> >>
> >>
> >>
> >> On Thu, Oct 15, 2015 at 5:41 PM, Matthew S Wallace
> >> <mwallace@ccmtrading.com> wrote:
> >> > What version of CMake are you using? I'm using 3.3.2. The only other
> >> > thing I did was:
> >> >
> >> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)
> >> >
> >> > I'm guessing this probably does nothing since it is probably a target
> >> > property.
> >> >
> >> > -Matt
> >> >
> >> >> On Oct 15, 2015, at 10:34 AM, Petr Bena <benapetr@gmail.com> wrote:
> >> >>
> >> >> Can you elaborate on it a bit?
> >> >>
> >> >> I put set(CMAKE_CXX_STANDARD 11) as first line of my CMakeLists and
> it
> >> >> still doesn't work, without the hack I used I get errors while
> >> >> compiling.
> >> >>
> >> >> Can you give me example file in which it works? I guess there is more
> >> >> needed for it to work.
> >> >>
> >> >> On Tue, Oct 13, 2015 at 7:12 PM, Matthew S Wallace
> >> >> <mwallace@ccmtrading.com> wrote:
> >> >>> Thanks, setting the global variable solved my issue.
> >> >>>
> >> >>> -Matt
> >> >>>
> >> >>>> On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl
> >> >>>> <johannes.zarl-zierl@jku.at> wrote:
> >> >>>>
> >> >>>> Hi,
> >> >>>>
> >> >>>> CXX_STANDARD is a target property, not a global one. You can either
> >> >>>> set
> >> >>>> CXX_STANDARD for every target that needs it, or set it globally by
> >> >>>> changing
> >> >>>> the default value.
> >> >>>>
> >> >>>> You can do the latter by setting the variable CMAKE_CXX_STANDARD
> >> >>>> before
> >> >>>> defining any target that depends on it:
> >> >>>>
> >> >>>> set(CMAKE_CXX_STANDARD 11)
> >> >>>>
> >> >>>> HTH,
> >> >>>> Johannes
> >> >>>>
> >> >>>> On Tuesday 13 October 2015 10:22:36 Matthew S Wallace wrote:
> >> >>>>> I have the following two lines in my CMakeLists.txt
> >> >>>>>
> >> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD 11)
> >> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)
> >> >>>>>
> >> >>>>> However when compiling some of my source files, the -std=c++11
> flag
> >> >>>>> is not
> >> >>>>> added.
> >> >>>>>
> >> >>>>> Just for good measure I added:
> >> >>>>> target_compile_features(my_target PRIVATE cxx_strong_enums) to the
> >> >>>>> target
> >> >>>>> that was having the problem.
> >> >>>>>
> >> >>>>> Not sure if it matters, but in this case the compile error I'm
> >> >>>>> getting is
> >> >>>>> complaining because I'm referencing a fully scoped enum. If I
> >> >>>>> explicitly
> >> >>>>> include -std=c++11 in my compile flags, everything works.
> >> >>>>>
> >> >>>>> I'm thinking I'm probably just misunderstanding how CXX_STANDARD
> >> >>>>> works, but
> >> >>>>> any help would be appreciated.
> >> >>>>>
> >> >>>>> -Matt
> >> >>>>
> >> >>>> --
> >> >>>>
> >> >>>> Powered by www.kitware.com
> >> >>>>
> >> >>>> Please keep messages on-topic and check the CMake FAQ at:
> >> >>>> http://www.cmake.org/Wiki/CMake_FAQ
> >> >>>>
> >> >>>> Kitware offers various services to support the CMake community. For
> >> >>>> more information on each offering, please visit:
> >> >>>>
> >> >>>> CMake Support: http://cmake.org/cmake/help/support.html
> >> >>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> >> >>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
> >> >>>>
> >> >>>> Visit other Kitware open-source projects at
> >> >>>> http://www.kitware.com/opensource/opensource.html
> >> >>>>
> >> >>>> Follow this link to subscribe/unsubscribe:
> >> >>>> http://public.kitware.com/mailman/listinfo/cmake
> >> >>>
> >> >>> --
> >> >>>
> >> >>> Powered by www.kitware.com
> >> >>>
> >> >>> Please keep messages on-topic and check the CMake FAQ at:
> >> >>> http://www.cmake.org/Wiki/CMake_FAQ
> >> >>>
> >> >>> Kitware offers various services to support the CMake community. For
> >> >>> more information on each offering, please visit:
> >> >>>
> >> >>> CMake Support: http://cmake.org/cmake/help/support.html
> >> >>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> >> >>> CMake Training Courses: http://cmake.org/cmake/help/training.html
> >> >>>
> >> >>> Visit other Kitware open-source projects at
> >> >>> http://www.kitware.com/opensource/opensource.html
> >> >>>
> >> >>> Follow this link to subscribe/unsubscribe:
> >> >>> http://public.kitware.com/mailman/listinfo/cmake
> >> >
> >> --
> >>
> >> Powered by www.kitware.com
> >>
> >> Please keep messages on-topic and check the CMake FAQ at:
> >> http://www.cmake.org/Wiki/CMake_FAQ
> >>
> >> Kitware offers various services to support the CMake community. For more
> >> information on each offering, please visit:
> >>
> >> CMake Support: http://cmake.org/cmake/help/support.html
> >> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> >> CMake Training Courses: http://cmake.org/cmake/help/training.html
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://public.kitware.com/mailman/listinfo/cmake
> >
> >
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
[Attachment #5 (text/html)]
<div dir="ltr">Hello,<div><br></div><div>CMake 3.3.1 is available from my PPA, in \
case it helps:</div><div><br></div><div><a \
href="https://launchpad.net/~pgquiles/+archive/ubuntu/ppa">https://launchpad.net/~pgquiles/+archive/ubuntu/ppa</a><br></div><div><br></div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 16, 2015 at 10:58 AM, \
Petr Bena <span dir="ltr"><<a href="mailto:benapetr@gmail.com" \
target="_blank">benapetr@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">If I did that nearly nobody would be able to compile my \
program as<br> cmake >= 3.1 is extremely rare on most distributions. Even \
ubuntu's<br> PPA builder has some ancient version.<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Oct 16, 2015 at 9:44 AM, Petr Kmoch <<a \
href="mailto:petr.kmoch@gmail.com">petr.kmoch@gmail.com</a>> wrote:<br> > Hi \
Petr.<br> ><br>
> You're using a feature (`CMAKE_CXX_STANDARD`) introduced in CMake \
version<br> > 3.1, so you should require a minimum version >= that.<br>
><br>
> You can learn the version of CMake by running `cmake --version`<br>
><br>
> Petr<br>
><br>
> On Thu, Oct 15, 2015 at 5:45 PM, Petr Bena <<a \
href="mailto:benapetr@gmail.com">benapetr@gmail.com</a>> wrote:<br> >><br>
>> What do you mean by "target" property? I don't see any \
target<br> >> mentioned there. I don't have this line in there. I don't \
know which<br> >> CMake this is, it failed on server we use for unit tests, but \
I have<br> >> required min. version set to 2.8.7<br>
>><br>
>><br>
>><br>
>> On Thu, Oct 15, 2015 at 5:41 PM, Matthew S Wallace<br>
>> <<a href="mailto:mwallace@ccmtrading.com">mwallace@ccmtrading.com</a>> \
wrote:<br> >> > What version of CMake are you using? I'm using 3.3.2. \
The only other<br> >> > thing I did was:<br>
>> ><br>
>> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)<br>
>> ><br>
>> > I'm guessing this probably does nothing since it is probably a \
target<br> >> > property.<br>
>> ><br>
>> > -Matt<br>
>> ><br>
>> >> On Oct 15, 2015, at 10:34 AM, Petr Bena <<a \
href="mailto:benapetr@gmail.com">benapetr@gmail.com</a>> wrote:<br> >> \
>><br> >> >> Can you elaborate on it a bit?<br>
>> >><br>
>> >> I put set(CMAKE_CXX_STANDARD 11) as first line of my CMakeLists and \
it<br> >> >> still doesn't work, without the hack I used I get errors \
while<br> >> >> compiling.<br>
>> >><br>
>> >> Can you give me example file in which it works? I guess there is \
more<br> >> >> needed for it to work.<br>
>> >><br>
>> >> On Tue, Oct 13, 2015 at 7:12 PM, Matthew S Wallace<br>
>> >> <<a \
href="mailto:mwallace@ccmtrading.com">mwallace@ccmtrading.com</a>> wrote:<br> \
>> >>> Thanks, setting the global variable solved my issue.<br> \
>> >>><br> >> >>> -Matt<br>
>> >>><br>
>> >>>> On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl<br>
>> >>>> <<a \
href="mailto:johannes.zarl-zierl@jku.at">johannes.zarl-zierl@jku.at</a>> \
wrote:<br> >> >>>><br>
>> >>>> Hi,<br>
>> >>>><br>
>> >>>> CXX_STANDARD is a target property, not a global one. You \
can either<br> >> >>>> set<br>
>> >>>> CXX_STANDARD for every target that needs it, or set it \
globally by<br> >> >>>> changing<br>
>> >>>> the default value.<br>
>> >>>><br>
>> >>>> You can do the latter by setting the variable \
CMAKE_CXX_STANDARD<br> >> >>>> before<br>
>> >>>> defining any target that depends on it:<br>
>> >>>><br>
>> >>>> set(CMAKE_CXX_STANDARD 11)<br>
>> >>>><br>
>> >>>> HTH,<br>
>> >>>> Johannes<br>
>> >>>><br>
>> >>>> On Tuesday 13 October 2015 10:22:36 Matthew S Wallace \
wrote:<br> >> >>>>> I have the following two lines in my \
CMakeLists.txt<br> >> >>>>><br>
>> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD 11)<br>
>> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)<br>
>> >>>>><br>
>> >>>>> However when compiling some of my source files, the \
-std=c++11 flag<br> >> >>>>> is not<br>
>> >>>>> added.<br>
>> >>>>><br>
>> >>>>> Just for good measure I added:<br>
>> >>>>> target_compile_features(my_target PRIVATE \
cxx_strong_enums) to the<br> >> >>>>> target<br>
>> >>>>> that was having the problem.<br>
>> >>>>><br>
>> >>>>> Not sure if it matters, but in this case the compile \
error I'm<br> >> >>>>> getting is<br>
>> >>>>> complaining because I'm referencing a fully scoped \
enum. If I<br> >> >>>>> explicitly<br>
>> >>>>> include -std=c++11 in my compile flags, everything \
works.<br> >> >>>>><br>
>> >>>>> I'm thinking I'm probably just misunderstanding how \
CXX_STANDARD<br> >> >>>>> works, but<br>
>> >>>>> any help would be appreciated.<br>
>> >>>>><br>
>> >>>>> -Matt<br>
>> >>>><br>
>> >>>> --<br>
>> >>>><br>
>> >>>> Powered by <a href="http://www.kitware.com" \
rel="noreferrer" target="_blank">www.kitware.com</a><br> >> \
>>>><br> >> >>>> Please keep messages on-topic and \
check the CMake FAQ at:<br> >> >>>> <a \
href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br> >> \
>>>><br> >> >>>> Kitware offers various services to \
support the CMake community. For<br> >> >>>> more information on \
each offering, please visit:<br> >> >>>><br>
>> >>>> CMake Support: <a \
href="http://cmake.org/cmake/help/support.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/support.html</a><br> >> \
>>>> CMake Consulting: <a \
href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/consulting.html</a><br> >> \
>>>> CMake Training Courses: <a \
href="http://cmake.org/cmake/help/training.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/training.html</a><br> >> \
>>>><br> >> >>>> Visit other Kitware open-source \
projects at<br> >> >>>> <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> >> \
>>>><br> >> >>>> Follow this link to \
subscribe/unsubscribe:<br> >> >>>> <a \
href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" \
target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br> >> \
>>><br> >> >>> --<br>
>> >>><br>
>> >>> Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> >> >>><br>
>> >>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> >>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br> >> >>><br>
>> >>> Kitware offers various services to support the CMake community. \
For<br> >> >>> more information on each offering, please visit:<br>
>> >>><br>
>> >>> CMake Support: <a \
href="http://cmake.org/cmake/help/support.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/support.html</a><br> >> \
>>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" \
rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br> \
>> >>> CMake Training Courses: <a \
href="http://cmake.org/cmake/help/training.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/training.html</a><br> >> \
>>><br> >> >>> Visit other Kitware open-source projects \
at<br> >> >>> <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> >> \
>>><br> >> >>> Follow this link to subscribe/unsubscribe:<br>
>> >>> <a href="http://public.kitware.com/mailman/listinfo/cmake" \
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
>> ><br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> >><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br> >><br>
>> Kitware offers various services to support the CMake community. For more<br>
>> information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" \
rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br> \
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" \
rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br> \
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" \
rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br> \
>><br> >> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> \
>><br> >> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" \
target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br> ><br>
><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> <br>
Please keep messages on-topic and check the CMake FAQ at: <a \
href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br> <br>
Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:<br> <br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/support.html</a><br> CMake Consulting: <a \
href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/consulting.html</a><br> CMake Training \
Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/training.html</a><br> <br>
Visit other Kitware open-source projects at <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" \
target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></div></div></blockquote></div><br><br \
clear="all"><div><br></div>-- <br><div class="gmail_signature">Pau Garcia i \
Quiles<br><a href="http://www.elpauer.org" \
target="_blank">http://www.elpauer.org</a><br>(Due to my workload, I may need 10 days \
to answer)</div> </div>
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic