debugfull & clang/ccache
Alexander Neundorf
neundorf at kde.org
Tue Jul 23 16:54:47 UTC 2013
On Tuesday 23 July 2013, Milian Wolff wrote:
> On Monday 22 July 2013 22:28:08 Alexander Neundorf wrote:
> > Hi Millian,
> >
> > On Tuesday 16 July 2013, Milian Wolff wrote:
> > > On Tuesday 16 July 2013 11:30:22 Andreas Pakulat wrote:
> > > > Hi,
> > > >
> > > > On Mon, Jul 15, 2013 at 10:52 AM, Milian Wolff <mail at milianw.de>
wrote:
> > > > > Hey guys,
> > > > >
> > > > > the handling of CMAKE_BUILD_TYPE=debugfull in
> > > > > FindKDE4Internal.cmake is
> > > > > guarded by `if (CMAKE_COMPILER_IS_GNUCXX)` so it won't work if you
> > > > > use clang.
> > > > > It gets worse if you use ccache as well, i.e. via
> > > >
> > > > Hmm, interesting, I just noticed that Debian seems to have dropped
> > > > support for Debugfull completely, only 1 reference in the file and
> > > > that is in a comment.
> > > >
> > > > I'd say an "OR CMAKE_CXX_COMPILER_ID MATCHES 'clang'" should be
> > > > sufficient, the cmake manual hints towards the compiler id being set
> > > > to 'clang' (in a more or less unrelated part, but the other
> > > > mentioned id's match whats in that variable on the corresponding
> > > > compilers). So the line should be
> > > >
> > > > if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES 'clang'
> > > > )
> > >
> > > OK, but the FindKDE4Internal contains more such checks and everywhere I
> > > wonder whether clang shouldn't do the same... I.e. more pedantic linker
> > > flags, determining include dirs, fPIE, visibility, etc. pp. - I
> > > actually wonder why I can compile stuff with clang at all ;-)
> > >
> > > So, anyways. Should I write a patch with what you hint at as an initial
> > > step towards better clang support? Or do we need to think more about
> > > that?
> >
> > There is/was nothing about clang in these files because nobody who used
> > felt the need to fix it.
> > So thanks for your effort. :-)
> >
> > While at it, could you please also have a look at extra-cmake-modules (
> > https://projects.kde.org/projects/kdesupport/extra-cmake-modules/reposito
> > ry ), in kde-modules/KDECompilerSettings.cmake there are the compiler
> > settings for KF5. They have been moved there from
> > FindKDE4Internal.cmake, so that whoever wants, can or cannot use the
> > compiler settings from KDE.
> >
> > ...IS_GNU_CXX is not used anymore there, but instead always the
> > COMPILER_ID, i.e. it is now compared against "GNU".
>
> Yeah, I think at least loc 155 needs to include Clang. The block starting
> at loc 239 needs to also support Clang, whereas the code above with the
> version check should stay gcc specific.
>
> Anyhow, I don't have a KF5 setup available, so I can't test this properly -
> so no patch from me for now :(
Oh, that's easy.
Get cmake 2.8.11.
git clone extra-cmake-modules, build it and install it.
Add the install dir to CMAKE_PREFIX_PATH if necessary.
And write a small hello world:
cmake_minimum_required(VERSION 2.8.11)
find_package(ECM NO_MODULE REQUIRED)
include(${ECM_KDE_MODULE_DIR}/KDECompilerSettings)
add_executable(hello main.cpp)
This should give you just the KDE-recommended compiler flags.
It would be cool if you could give this a try, and let me know if it works or
whether there are issues.
Thanks
Alex
More information about the Kde-buildsystem
mailing list