Add basic support for clang in FindKDE4Internal.cmake

Review Request #111612 - Created July 20, 2013 and submitted

Information
Milian Wolff
kdelibs
master
Reviewers
buildsystem
apaku, neundorf, skelly
When building KDE applications with clang, multiple issues arise:

- debugfull is not supported at all, it's as if one gives an 'invalid' build type to cmake (i.e. neither -O nor -g is present)
- most of the "pedantic" flags are not set properly, such as those that ensure proper visibility macros etc. pp.
- none of the above is communicated to the developer, the might compile for him but not work as expected or he will introduce issues for others (like the windows guys)

This patch lets clang use the same codepaths as gcc which works due to its CLI compatibility interface.
I get this build error in kdevelop now: 

[ 48%] Building C object projectmanagers/cmake/CMakeFiles/kdev4cmakecommon.dir/parser/cmListFileLexer.o
cmListFileLexer.c:1566:48: error: implicit declaration of function 'fileno' [-Werror,-Wimplicit-function-declaration]
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
                                               ^
1 error generated.
make[2]: *** [projectmanagers/cmake/CMakeFiles/kdev4cmakecommon.dir/parser/cmListFileLexer.o] Error 1

Besides that, I successfully built kate and kdevplatform in debugfull with clang 3.3 and finally have my debug symbols back!
So how can I fix the above? The file is generated and apparently contains a posix-ism which is not available anymore on clang?
How does one do that in a platform independent way?

Other than that, here is e.g. the cmake output for kdevelop:

-- The C compiler identification is Clang 3.3.0
-- The CXX compiler identification is Clang 3.3.0
-- Check for working C compiler: /usr/bin/ccache
-- Check for working C compiler: /usr/bin/ccache -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/ccache
-- Check for working CXX compiler: /usr/bin/ccache -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt-Version 4.8.5 (using /usr/bin/qmake-qt4)
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so;/usr/lib64/libXft.so;/usr/lib64/libXau.so;/usr/lib64/libXdmcp.so;/usr/lib64/libXpm.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so;/usr/lib64/libXft.so;/usr/lib64/libXau.so;/usr/lib64/libXdmcp.so;/usr/lib64/libXpm.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib64/libX11.so
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.1e") 
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found Automoc4: /usr/bin/automoc4  
-- Found Perl: /usr/bin/perl (found version "5.18.0") 
-- Adding /home/milian/projects/compiled/kde4/share/apps/cmake/modules to CMAKE_MODULE_PATH
-- Found Phonon: /usr/include/qt4 (Required is at least version "4.3.80") 
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_FPIE_SUPPORT
-- Performing Test HAVE_FPIE_SUPPORT - Success
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL - Success
-- Performing Test __KDE_HAVE_GCC_VISIBILITY
-- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
-- Found KDE 4.10 include dir: /usr/include
-- Found KDE 4.10 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Found KDevPlatform: /home/milian/projects/compiled/kde4/lib/cmake/kdevplatform/KDevPlatformConfig.cmake (Required is at least version "1.5.60") 
-- Found SharedMimeInfo: /usr/bin/update-mime-database (found suitable version "1.1", minimum required is "0.18") 
-- Found KDeclarative: /usr/include  
-- Found KDE4Workspace: /usr/lib64/cmake/KDE4Workspace/KDE4WorkspaceConfig.cmake (Required is at least version "4.2.0") 
-- Found Okteta Kasten libraries v2: /usr/lib64/libkasten2okteta1core.so;/usr/lib64/libkasten2okteta1gui.so;/usr/lib64/libkasten2okteta1controllers.so
-- Found Okteta libraries v1: /usr/lib64/libokteta1core.so;/usr/lib64/libokteta1gui.so
-- Found Kasten libraries v2: /usr/lib64/libkasten2core.so;/usr/lib64/libkasten2gui.so;/usr/lib64/libkasten2controllers.so
-- Found KDevPlatform: /home/milian/projects/compiled/kde4/lib/cmake/kdevplatform/KDevPlatformConfig.cmake  
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for module 'QJson'
--   found QJson, version 0.8.1
-- Found QJson: /usr/lib64/libqjson.so
Milian Wolff
Milian Wolff
Andreas Pakulat
Commit Hook
Commit Hook
Milian Wolff
Review request changed

Status: Closed (submitted)

Loading...