I'm trying to turn on a bit more warnings in a C project but I'm running
into an ordering issue.

I have

#+BEGIN_SRC cmake
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "-Wall -Wextra -Werror")
#+END_SRC

and I want to add ~-Wpedantic~. However if I do then I get a lot of warnings
(that are turned into errors) about breaking C99. In particular:

#+BEGIN_QUOTE
ISO C99 requires at least one argument for the "..." in a variadic macro 
[-Werror]
#+END_QUOTE

This apparently comes from ~-std=gnu11~ (the result of setting
~CMAKE_C_STANDARD~) appearing /after/ the other flags. If I change my
~CMakeLists.txt~ to instead contain

#+BEGIN_SRC cmake
set(CMAKE_C_FLAGS "-std=gnu11 -Wall -Wextra -Wpedantic -Werror")
#+END_SRC

Then I don't get those C99-related warnings. Is there some way to get
~CMAKE_C_STANDARD~ to put ~-std=gnu11~ /before/ the other flags?

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe               http://therning.org/magnus

LeBlanc's law: Later equals never.

Attachment: signature.asc
Description: PGP signature

-- 

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

Reply via email to