From cmake Fri Oct 16 09:26:00 2015 From: Pau Garcia i Quiles Date: Fri, 16 Oct 2015 09:26:00 +0000 To: cmake Subject: Re: [CMake] C++11 flag not being added Message-Id: X-MARC-Message: https://marc.info/?l=cmake&m=144498759502999 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============1532019118==" --===============1532019118== Content-Type: multipart/alternative; boundary=001a1140ed366a92e7052235634c --001a1140ed366a92e7052235634c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 wrote: > If I did that nearly nobody would be able to compile my program as > cmake >=3D 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 wrote: > > Hi Petr. > > > > You're using a feature (`CMAKE_CXX_STANDARD`) introduced in CMake versi= on > > 3.1, so you should require a minimum version >=3D that. > > > > You can learn the version of CMake by running `cmake --version` > > > > Petr > > > > On Thu, Oct 15, 2015 at 5:45 PM, Petr Bena 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 > >> wrote: > >> > What version of CMake are you using? I=E2=80=99m using 3.3.2. The = only other > >> > thing I did was: > >> > > >> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED) > >> > > >> > I=E2=80=99m guessing this probably does nothing since it is probably= a target > >> > property. > >> > > >> > -Matt > >> > > >> >> On Oct 15, 2015, at 10:34 AM, Petr Bena 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 mo= re > >> >> needed for it to work. > >> >> > >> >> On Tue, Oct 13, 2015 at 7:12 PM, Matthew S Wallace > >> >> wrote: > >> >>> Thanks, setting the global variable solved my issue. > >> >>> > >> >>> -Matt > >> >>> > >> >>>> On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl > >> >>>> wrote: > >> >>>> > >> >>>> Hi, > >> >>>> > >> >>>> CXX_STANDARD is a target property, not a global one. You can eith= er > >> >>>> set > >> >>>> CXX_STANDARD for every target that needs it, or set it globally b= y > >> >>>> 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=3Dc++11 > flag > >> >>>>> is not > >> >>>>> added. > >> >>>>> > >> >>>>> Just for good measure I added: > >> >>>>> target_compile_features(my_target PRIVATE cxx_strong_enums) to t= he > >> >>>>> target > >> >>>>> that was having the problem. > >> >>>>> > >> >>>>> Not sure if it matters, but in this case the compile error I=E2= =80=99m > >> >>>>> getting is > >> >>>>> complaining because I=E2=80=99m referencing a fully scoped enum.= If I > >> >>>>> explicitly > >> >>>>> include -std=3Dc++11 in my compile flags, everything works. > >> >>>>> > >> >>>>> I=E2=80=99m thinking I=E2=80=99m 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. F= or > >> >>>> 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. Fo= r > >> >>> 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 mo= re > >> 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 > --=20 Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) --001a1140ed366a92e7052235634c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

CMake 3.3.1 is available from my= PPA, in case it helps:




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 >=3D 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 >=3D 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 a= ny 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 ha= ve
>> 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?=C2=A0 I=E2=80=99m using = 3.3.2.=C2=A0 The only other
>> > thing I did was:
>> >
>> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)
>> >
>> > I=E2=80=99m guessing this probably does nothing since it is p= robably 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 CMak= eLists and it
>> >> still doesn't work, without the hack I used I get err= ors while
>> >> compiling.
>> >>
>> >> Can you give me example file in which it works? I guess t= here is more
>> >> needed for it to work.
>> >>
>> >> On Tue, Oct 13, 2015 at 7:12 PM, Matthew S Wallace
>> >> <mwallace@c= cmtrading.com> wrote:
>> >>> Thanks, setting the global variable solved my issue.<= br> >> >>>
>> >>> -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 o= ne. You can either
>> >>>> set
>> >>>> CXX_STANDARD for every target that needs it, or s= et it globally by
>> >>>> changing
>> >>>> the default value.
>> >>>>
>> >>>> You can do the latter by setting the variable CMA= KE_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 Wal= lace wrote:
>> >>>>> I have the following two lines in my CMakeLis= ts.txt
>> >>>>>
>> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD 11)=
>> >>>>> set_property(GLOBAL PROPERTY CXX_STANDARD_REQ= UIRED)
>> >>>>>
>> >>>>> However when compiling some of my source file= s, the -std=3Dc++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=E2=80=99m
>> >>>>> getting is
>> >>>>> complaining because I=E2=80=99m referencing a= fully scoped enum.=C2=A0 If I
>> >>>>> explicitly
>> >>>>> include -std=3Dc++11 in my compile flags, eve= rything works.
>> >>>>>
>> >>>>> I=E2=80=99m thinking I=E2=80=99m probably jus= t 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 CM= ake community. For
>> >>>> more information on each offering, please visit:<= br> >> >>>>
>> >>>> CMake Support: http://cmake.org/cm= ake/help/support.html
>> >>>> CMake Consulting: http://cmake.= org/cmake/help/consulting.html
>> >>>> CMake Training Courses: http://cm= ake.org/cmake/help/training.html
>> >>>>
>> >>>> Visit other Kitware open-source projects at
>> >>>> http://www.kitware.com/op= ensource/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/openso= urce/opensource.html
>> >>>
>> >>> Follow this link to subscribe/unsubscribe:
>> >>> http://public.kitware.com/mail= man/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. Fo= r more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.= html
>> CMake Consulting: http://cmake.org/cmake/help/co= nsulting.html
>> CMake Training Courses: http://cmake.org/cmake/hel= p/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensou= rce.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinf= o/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 in= formation on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html<= br> CMake Consulting: http://cmake.org/cmake/help/consulting.= html
CMake Training Courses: http://cmake.org/cmake/help/trainin= g.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 wo= rkload, I may need 10 days to answer)
--001a1140ed366a92e7052235634c-- --===============1532019118== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- 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 --===============1532019118==--