Hi Mathias, I simply guess that the reason for COMPILE_DEFINITIONS not including -pedantic is, that you actually use add_definitions() for something what it is not really intended for, i.e., the addition of compiler flags other than those which define preprocessor macros... maybe add_definitions() recognizes it as compiler flags and adds it to either one of the variables which define the compiler flags. Check the value of the target property COMPILE_FLAGS on one of the targets added after the add_definitions() call.
However, you should actually add "global" compiler flags to the (command-line argument) srings (not CMake lists!) CMAKE_CXX_FLAGS, CMAKE_C_FLAGS, CMAKE_CXX_<CONFIG>, CMAKE_C_FLAGS_<CONFIG>. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") Andreas On Wed, Apr 18, 2012 at 10:23 AM, Mathias Gaunard <mathias.gaun...@ens-lyon.org> wrote: > Is there a way to read back what flags were added with add_definitions? > > If I do > > add_definitions(DFOO=bar -pedantic) > > when I read the COMPILE_DEFINITIONS property of the directory all I have is > FOO=bar > > How can I know the -pedantic option is being used for all targets in the > directory? > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake