Re: [CMake] C++11 flag not being added
You can use CMake 3.x on older systems. Write platform checks for specific C++11 features and implement "old" style code if the C++11 features (e.g. lambdas) are not available. Use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html and https://cmake.org/cmake/help/v3.1/module/WriteCompilerDetectionHeader.html?highlight=compiler%20detection%20header#module:WriteCompilerDetectionHeader to detect if your compiler supports your implementation. Best Regards > Am 16.10.2015 um 14:09 schrieb Hendrik Sattler: > > > > Am 16. Oktober 2015 13:38:27 MESZ, schrieb Petr Bena : >> By stable you mean Jessie that was recently released and is almost >> nowhere in production yet? :) >> >> On my debian server: >> >> $ cmake --version >> cmake version 2.8.9 >> >> On one of wikimedia's ubuntu servers (the newer ones): >> >> $ cmake --version >> cmake version 2.8.12.2 >> >> On travis-ci cmake is about 2.8.7 and on ubuntu PPA builder it's >> probably same. >> >> And we aren't even talking about 3.0, but 3.1 or newer. One would need >> to be truly naive to expect newer version on some stable production >> systems, that usually run well established older software (eg. >> majority of them do). >> >> On my dev PC I have last CMake of course, but I need to be able to >> compile on other systems as well :) >> >> This code is meant to be cross-platform and buildable on most of >> supported OS'es, even on older versions. I sincerely hate programs >> that requires extremely latest versions of tools or libraries for them >> to work, because these are usually hard to build. > > They want to self-compile the latest of your software but use several years > old versions of everything else? > I'd understand the Ubuntu use case but not the Debian oldstable one. > > If everyone develops like this, the software system grinds to a halt. > Recursively, I mean. > > Just as a reminder for you regarding people of other systems: using C++11 > excludes a lot of older compilers, e.g. MS VS6 or 7.1 or 8 or 9 ;-) > > OTOH, if you have a very specific target audience... > >> On Fri, Oct 16, 2015 at 11:56 AM, Hendrik Sattler >> wrote: >>> >>> >>> Am 16. Oktober 2015 11:29:48 MESZ, schrieb Petr Bena >> : I think you completely misunderstood me. I know I can install it on >> my machine, but I can hardly install it on PC's or servers of users who use my program. I want to make it as easy as possible to let users compile my >> program. Having to install anything by hand instead of system package manager is a big overhead to majority of users. CMake 3x is too new, it's >>> >>> >>> Hey, 3.0.2 is even available in Debian stable, and that really says >> something about older versions! >>> >>> available by default almost nowhere, meaning this option is not available to me at this time. Maybe in few years the situation will change, but for now I will resort to that hack which works on older versions that are generally available everywhere. On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quiles wrote: > 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 >= 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 >>> 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 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’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
Re: [CMake] C++11 flag not being added
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 Benawrote: > 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’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 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 > >> wrote: > >>> Thanks, setting the global variable solved my issue. > >>> > >>> -Matt > >>> > On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl < > johannes.zarl-zi...@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: >
Re: [CMake] C++11 flag not being added
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 Kmochwrote: > 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 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’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 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 >> >> 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 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
Re: [CMake] C++11 flag not being added
Hi Petr, you can download CMake from https://cmake.org/download/. There are also prebuilt binaries available. We use the *.sh files to install CMake on our linux servers. .) Install CMake to /opt/cmake-3.4.2. .) Create a symlink to /opt/cmake .) Create another symlink from the /opt/cmake/bin/* to /usr/bin With this solution you only need to update the first symlink if you want to upgrade/downgrade a CMake version. Best Regards Roman > Am 16.10.2015 um 10:58 schrieb Petr Bena: > > 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 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 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’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 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 > 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 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
Re: [CMake] C++11 flag not being added
I think you completely misunderstood me. I know I can install it on my machine, but I can hardly install it on PC's or servers of users who use my program. I want to make it as easy as possible to let users compile my program. Having to install anything by hand instead of system package manager is a big overhead to majority of users. CMake 3x is too new, it's available by default almost nowhere, meaning this option is not available to me at this time. Maybe in few years the situation will change, but for now I will resort to that hack which works on older versions that are generally available everywhere. On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quileswrote: > 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 >= 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 >> > 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 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’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 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 >> >> >> 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 >> >> 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:
Re: [CMake] C++11 flag not being added
Am 16. Oktober 2015 11:29:48 MESZ, schrieb Petr Bena: >I think you completely misunderstood me. I know I can install it on my >machine, but I can hardly install it on PC's or servers of users who >use my program. > >I want to make it as easy as possible to let users compile my program. >Having to install anything by hand instead of system package manager >is a big overhead to majority of users. CMake 3x is too new, it's >available by default almost nowhere, meaning this option is not >available to me at this time. Maybe in few years the situation will >change, but for now I will resort to that hack which works on older >versions that are generally available everywhere. And what are those systems that bring an ancient cmake version but real C++11 support? Note that many C++ libraries must be recompiled with c++11 enabled during compilation when you want to use them in your C++11 program. >On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quiles > wrote: >> 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 >= 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 >>> > 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 >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’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 >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 >>> >> >> 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 >>> >> 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. >>> >> >
Re: [CMake] C++11 flag not being added
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 Benawrote: > 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 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 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’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 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 > >> >> 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 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
Re: [CMake] C++11 flag not being added
Am 16. Oktober 2015 11:29:48 MESZ, schrieb Petr Bena: >I think you completely misunderstood me. I know I can install it on my >machine, but I can hardly install it on PC's or servers of users who >use my program. > >I want to make it as easy as possible to let users compile my program. >Having to install anything by hand instead of system package manager >is a big overhead to majority of users. CMake 3x is too new, it's Hey, 3.0.2 is even available in Debian stable, and that really says something about older versions! >available by default almost nowhere, meaning this option is not >available to me at this time. Maybe in few years the situation will >change, but for now I will resort to that hack which works on older >versions that are generally available everywhere. > >On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quiles > wrote: >> 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 >= 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 >>> > 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 >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’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 >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 >>> >> >> 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 >>> >> 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 >>> >> >>> >>
Re: [CMake] C++11 flag not being added
Am 16. Oktober 2015 13:38:27 MESZ, schrieb Petr Bena: >By stable you mean Jessie that was recently released and is almost >nowhere in production yet? :) > >On my debian server: > >$ cmake --version >cmake version 2.8.9 > >On one of wikimedia's ubuntu servers (the newer ones): > >$ cmake --version >cmake version 2.8.12.2 > >On travis-ci cmake is about 2.8.7 and on ubuntu PPA builder it's >probably same. > >And we aren't even talking about 3.0, but 3.1 or newer. One would need >to be truly naive to expect newer version on some stable production >systems, that usually run well established older software (eg. >majority of them do). > >On my dev PC I have last CMake of course, but I need to be able to >compile on other systems as well :) > >This code is meant to be cross-platform and buildable on most of >supported OS'es, even on older versions. I sincerely hate programs >that requires extremely latest versions of tools or libraries for them >to work, because these are usually hard to build. They want to self-compile the latest of your software but use several years old versions of everything else? I'd understand the Ubuntu use case but not the Debian oldstable one. If everyone develops like this, the software system grinds to a halt. Recursively, I mean. Just as a reminder for you regarding people of other systems: using C++11 excludes a lot of older compilers, e.g. MS VS6 or 7.1 or 8 or 9 ;-) OTOH, if you have a very specific target audience... >On Fri, Oct 16, 2015 at 11:56 AM, Hendrik Sattler > wrote: >> >> >> Am 16. Oktober 2015 11:29:48 MESZ, schrieb Petr Bena > : >>>I think you completely misunderstood me. I know I can install it on >my >>>machine, but I can hardly install it on PC's or servers of users who >>>use my program. >>> >>>I want to make it as easy as possible to let users compile my >program. >>>Having to install anything by hand instead of system package manager >>>is a big overhead to majority of users. CMake 3x is too new, it's >> >> >> Hey, 3.0.2 is even available in Debian stable, and that really says >something about older versions! >> >> >>>available by default almost nowhere, meaning this option is not >>>available to me at this time. Maybe in few years the situation will >>>change, but for now I will resort to that hack which works on older >>>versions that are generally available everywhere. >>> >>>On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quiles >>> wrote: 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 >= 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 > > 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 >>>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’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 >>>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 > >> >> wrote: > >> >>> Thanks, setting the global variable solved my issue. > >> >>> > >> >>> -Matt > >> >>> > >> On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl > >>
Re: [CMake] C++11 flag not being added
By stable you mean Jessie that was recently released and is almost nowhere in production yet? :) On my debian server: $ cmake --version cmake version 2.8.9 On one of wikimedia's ubuntu servers (the newer ones): $ cmake --version cmake version 2.8.12.2 On travis-ci cmake is about 2.8.7 and on ubuntu PPA builder it's probably same. And we aren't even talking about 3.0, but 3.1 or newer. One would need to be truly naive to expect newer version on some stable production systems, that usually run well established older software (eg. majority of them do). On my dev PC I have last CMake of course, but I need to be able to compile on other systems as well :) This code is meant to be cross-platform and buildable on most of supported OS'es, even on older versions. I sincerely hate programs that requires extremely latest versions of tools or libraries for them to work, because these are usually hard to build. On Fri, Oct 16, 2015 at 11:56 AM, Hendrik Sattlerwrote: > > > Am 16. Oktober 2015 11:29:48 MESZ, schrieb Petr Bena : >>I think you completely misunderstood me. I know I can install it on my >>machine, but I can hardly install it on PC's or servers of users who >>use my program. >> >>I want to make it as easy as possible to let users compile my program. >>Having to install anything by hand instead of system package manager >>is a big overhead to majority of users. CMake 3x is too new, it's > > > Hey, 3.0.2 is even available in Debian stable, and that really says something > about older versions! > > >>available by default almost nowhere, meaning this option is not >>available to me at this time. Maybe in few years the situation will >>change, but for now I will resort to that hack which works on older >>versions that are generally available everywhere. >> >>On Fri, Oct 16, 2015 at 11:26 AM, Pau Garcia i Quiles >> wrote: >>> 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 >= 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 > 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 >>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’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 >>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 >> >> 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 >> 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: >>
Re: [CMake] C++11 flag not being added
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 Benawrote: > > 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 > 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 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
Re: [CMake] C++11 flag not being added
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 Wallacewrote: > 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 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
Re: [CMake] C++11 flag not being added
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 Wallacewrote: > 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 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 >> 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 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
[CMake] C++11 flag not being added
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
Re: [CMake] C++11 flag not being added
I would also like to know this, right now I do this and it works, but it produced warnings on MSVC, so I did this nasty patch: if(WIN32) if(MINGW) SET(CMAKE_CXX_FLAGS "-mwindows -std=c++11") endif() else() SET(CMAKE_CXX_FLAGS "-std=c++11") endif() however doing just the SET statement itself should work On Tue, Oct 13, 2015 at 5:22 PM, Matthew S Wallacewrote: > 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
Re: [CMake] C++11 flag not being added
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
Re: [CMake] C++11 flag not being added
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 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