KDECompilerSettings.cmake added to extra-cmake-modules

Alexander Neundorf neundorf at kde.org
Fri Feb 17 17:58:04 UTC 2012


Hi,

I extracted the compiler settings part from FindKDE4Internal.cmake and create 
a file KDECompilerSettings.cmake from it.
It is in extra-cmake-modules/kde-modules/.

This is by far not done.
I a lot of places where I saw things which seemed like they shouldn't be there 
I added a TODO and a comment what I think should be done instead or why it was 
added.

It also still directly sets the CMAKE_CXX_FLAGS etc. variables, which in 
general should not be done by any cmake module.

It contains:
* settings RPATH
* setting link flags
* setting compile flags
* setting up the build types
* settings definitions into _KDE4_PLATFORM_DEFINITIONS

What should we do ?
Instead of setting CMAKE_CXX_FLAGS, set e.g. KDE_CMAKE_CXX_FLAGS, and let the 
user decide whether he wants to use them ?
This might be quite some code in user projects, since they'll have to do this 
for all buildtypes.
Or they are clever and do 
set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}
     "${KDE_CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}")

(which is not good enough for the multi-configuration generators (xcode, 
MSVC), which use CMAKE_CONFIGURATION_TYPES instead.


Or put all that in a macro, so users have to do something like the following ?

include(KDECompilerSettings)
kde_add_build_flags() 


Or should we just declare that by including that file (which you don't have to 
do) you just get those flags automatically ?
Then maybe the RPATH settings should be not in this file, but somewhere else.


And one more note: for using this file, you currently need cmake git master.

Alex


More information about the Kde-frameworks-devel mailing list