Thanks for the pointers, that does answer my question. I would just set CXX_STANDARD to 11 and leave CXX_STANDARD_REQUIRED unset. -- Daniel
From: David Cole [mailto:[email protected]] Sent: Wednesday, October 29, 2014 11:38 AM To: Daniel Schepler Cc: [email protected] Subject: Re: [CMake] [ANNOUNCE] CMake 3.1.0-rc1 now ready for testing! I think your question about CXX_STANDARD is answered in the CXX_STANDARD docs: http://www.cmake.org/cmake/help/v3.1/prop_tgt/CXX_STANDARD.html If you MUST have it, you can set this property to ON: http://www.cmake.org/cmake/help/v3.1/prop_tgt/CXX_STANDARD_REQUIRED.html (Although I've not used it myself -- not sure what happens if the compiler does not support the standard. Hopefully, an error at CMake time... try it and let us know if it works for you.) HTH, David C. On Wed, Oct 29, 2014 at 2:15 PM, Daniel Schepler <[email protected]<mailto:[email protected]>> wrote: (Whoops, accidentally sent this via private email before.) My question was about this part of the example: add_executable(consumer_with consumer_with.cpp) target_link_libraries(consumer_with foo) set_property(TARGET consumer_with CXX_STANDARD 11) add_executable(consumer_no consumer_no.cpp) target_link_libraries(consumer_no foo) The question is: how do I detect whether CXX_STANDARD 11 is available before running the "set_property(TARGET consumer_with CXX_STANDARD 11)" line? -- Daniel -----Original Message----- From: Robert Maynard [mailto:[email protected]<mailto:[email protected]>] Sent: Wednesday, October 29, 2014 10:43 AM To: Daniel Schepler Cc: CMake MailingList Subject: Re: [CMake] [ANNOUNCE] CMake 3.1.0-rc1 now ready for testing! You can find the known compile features that can be detected at: http://www.cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html At the end of the compile-features manual page ( http://www.cmake.org/cmake/help/v3.1/manual/cmake-compile-features.7.html ) there is a section on how to mark a library as having conditional support on C++11 features. On Wed, Oct 29, 2014 at 12:58 PM, Daniel Schepler <[email protected]<mailto:[email protected]>> wrote: > Where would I find the list of available C++ language features? For > instance, I would suppose there's one for "auto", one for move > constructors/assignment operators, and one for "= delete" of default > constructors/destructors et al. These are probably the ones we'd be most > interested in here, for the moment. (Though with our requirements to support > older C++ compilers, we might not actually be able to use auto, as the > fallback would need the full type anyway.) Also, is there a portability > macro provided for the "= delete" feature? > > Also, how would I mark a target so that it activates C++11 features if > available, but falls back to old C++ if not? I do see the section on > detecting compiler features, but it's not clear to me how exactly how I'd > make the target use CXX_STANDARD 11 only if available. > -- > Daniel > > -- > > Powered by www.kitware.com<http://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<http://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
