I like an effort but not an implementation:
* It would be nice to not to set flags globally since we have more fine
control options like target_compile_options (i.e. different target may
have different warning settings)
* this will not work for Xcode since warnings should be set by
XCODE_ATTRIBUTE_* properties
Take a look at this approach:
* https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression
Though I think it should be simplified. Best implementation I see so far:
* Remove `RESULT_PROPERTIES`: implement warning flags ->
XCODE_ATTRIBUTE_* mapping in CMake itself
* Remove `CLEAR_GLOBAL` option: add user variable checking to CMake so
it will not set `/W3` (or any other warning flags) by default. May be
introduce new policy (?)
Ruslo
On 27-Mar-16 12:10, Geoffrey Viola wrote:
CMake should support an API to manage compiler warnings to simplify a
common problem. Using more compilers with high levels of warnings
means cheap static analysis and better conformance to standard C++.
Compiler warnings are an easy way to increase program reliability. A
use case would be to increase compilation warnings on all internal
code, ignore warnings on all 3^rd party code, and treat all warnings
as errors.
Attached is an initial attempt to control warnings in CMake. The API
has a short name (e.g. set_warnings_as_errors) for simplicity and a
more technical name (e.g. set_warnings_as_errors_folder) to specify
scope. Note that the short name acts on CMake’s folder scope and is
meant to be global. The current compilers considered are GCC, clang,
Green Hills, and MSVC. A CMake Warning is issued if the macro does not
support a specific compiler so that conformance can be guaranteed.
Thanks,
Geoffrey Viola
This message contains confidential information and is intended only
for the recipient. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately if you have received this e-mail by mistake and delete
this e-mail from your system. Finally, the recipient should check this
email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by
this email.
--
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-developers