Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Support for CMAKE_COMPILER_IS_GNUCC in sugar_generate_warning_flags #7

Open
0x47 opened this issue Oct 31, 2016 · 3 comments
Open

Support for CMAKE_COMPILER_IS_GNUCC in sugar_generate_warning_flags #7

0x47 opened this issue Oct 31, 2016 · 3 comments

Comments

@0x47
Copy link

0x47 commented Oct 31, 2016

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!

@0x47
Copy link
Author

0x47 commented Oct 31, 2016

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).

@ruslo
Copy link
Owner

ruslo commented Oct 31, 2016

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.

@0x47
Copy link
Author

0x47 commented Nov 2, 2016

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()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants