Support for CMAKE_COMPILER_IS_GNUCC in sugar_generate_warning_flags
Is there any particular reason not to support plain C compiler in the sugar_generate_warning_flags function? I changed line 28 from
set(is_gcc ${CMAKE_COMPILER_IS_GNUCXX})
to
set(is_gcc ${CMAKE_COMPILER_IS_GNUCXX} OR ${CMAKE_COMPILER_IS_GNUCC})
and it and it seems to work just fine so far.
Thanks for the nice module!
I just double checked (because of missing warnings) and I think plain C is not supported indeed (e.g. -Wmissing-prototypes, -Wstrict-prototypes, and -Wold-style-definition are not generated with ENABLE ALL). Is support for plain C planned for sugar?
Here is a list of warnings for GCC (C and Objective-C only warnings are marked as such).
Is there any particular reason not to support plain C compiler in the sugar_generate_warning_flags function?
No, however flags for C target will differs from C++ targets.
Is support for plain C planned for sugar?
I'm not planning to improve this part of Sugar because better approach is to implement this in CMake itself. The design is ready: https://cmake.org/pipermail/cmake-developers/2016-April/028279.html however I have not enough free time to implement it. There is no plans in near future to do it.
I understand, thank you.
Just for reference, I realized that using
set(is_gcc ${CMAKE_COMPILER_IS_GNUCXX} OR ${CMAKE_COMPILER_IS_GNUCC})
is plain wrong as set() does not evaluate the variables and instead creates a list. If anyone wants to take advantage of this quick and dirty fix, rather use:
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
set(is_gcc TRUE)
else()
set(is_gcc FALSE)
endif()