On 04/20/2014 03:57 AM, Stephen Kelly wrote:
>> Perhaps we can have a feature name like "cxx_std_11" to require a
>> given standard level with an error if it is not available.
> 
> Which compilers would provide that feature? GCC 4.8.1 and Clang 3.4 
> (complete support)? GCC 4.7 (First release after ratification. Has compile 
> flag -std=c++11)? GCC 4.3 (Has -std=c++0x)? MSVC? MSVC 2015 (speculative 
> full support)? MSVC 2010 (partial support)? MSVC 2008 (Has override 
> keyword)?

Consider a project that writes

 set(CMAKE_CXX_STANDARD 11)

and someone tries to build with a compiler for which CMake does not
know about a -std=c++11 flag.  Currently CMake generates no error
and "decays" to build with no flag at all.  Let's say the project
happens to build without the flag because the compiler defaults to
a hypothetical -std=ext11 flag.  Furthermore the project code
happens to (unintentionally) depend on that compiler's extensions
to c++11 to compile.  Everything appears to work.

Later CMake learns about the -std=c++11 flag for that compiler and
honors the CXX_STANDARD request by passing it.  Now the compiler
has its extensions disabled and the project fails to build.  This
was due to an update in CMake, not the project.

We need a way for a project to say that it should not build unless
CMake knows how to nominally enable support for the given language
level.  Within that level the project could do its own preprocessor
tests or use WriteCompilerDetectionHeader to adapt to the subset
of the language level the compiler actually supports.  However,
when CMake is asked to use a compiler it does not know supports
the language level at all, it should be an error.

-Brad

-- 

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/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to