KDE/kdelibs

Alexander Neundorf neundorf at kde.org
Sun Feb 19 22:23:20 CET 2006


SVN commit 511435 by neundorf:

-add basic support for different buildtypes with gcc, see FindKDE4.cmake (search for CMAKE_CXX_FLAGS_DEBUG)

by default "ReleaseWithDebugInfo"==RelWithDebInfo is used, which means "-O2 -g"
release means "-O2"
debug means "-O0 -g"

Are these flags ok ? If not, which should be used instead ?

Creating debug libs and linking to the debug libs of Qt will come later, when I'm back

Was there a special reason why -Os instead of -O2 was used on the Mac ?
If so, it has to be resotred.

Also, use the new names for the install directories in kio/kssl/kssl/

Alex

CCMAIL: kde-buildsystem at kde.org
CCMAIL: rangerrick at gmail.com



 M  +31 -6     cmake/modules/FindKDE4.cmake  
 M  +2 -0      kdecore/CMakeLists.txt  
 M  +1 -1      kio/kssl/kssl/CMakeLists.txt  
 M  +1 -1      kio/kssl/kssl/caroot/CMakeLists.txt  


--- trunk/KDE/kdelibs/cmake/modules/FindKDE4.cmake #511434:511435
@@ -8,6 +8,7 @@
 # KDE4_DCOPIDL_EXECUTABLE
 # KDE4_DCOPIDL2CPP_EXECUTABLE
 # KDE4_KCFGC_EXECUTABLE
+# KDE4_MEINPROC_EXECUTABLE
 # KDE4_FOUND
 # it also adds the following macros (from KDE4Macros.cmake)
 # ADD_FILE_DEPENDANCY
@@ -103,6 +104,7 @@
   # CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC
   set(KDE4_DCOPIDL2CPP_EXECUTABLE ${KDE4_LD_LIBRARY_PATH} ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/dcopidl2cpp )
   set(KDE4_KCFGC_EXECUTABLE ${KDE4_LD_LIBRARY_PATH} ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
+  set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc )
 
   # when building kdelibs, make the dcop and kcfg rules depend on the binaries...
   set( _KDE4_DCOPIDL2CPP_DEP dcopidl2cpp)
@@ -164,6 +166,12 @@
     /opt/kde4/bin
   )
 
+  FIND_PROGRAM(KDE4_MEINPROC_EXECUTABLE NAME meinproc PATHS
+    $ENV{KDEDIR}/bin
+    /opt/kde/bin
+    /opt/kde4/bin
+  )
+
 endif(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kglobal.h)
 
 
@@ -184,7 +192,13 @@
 endif(UNIX AND NOT APPLE)
 
 
+# Set a default build type for single-configuration
+# CMake generators if no build type is set.
+IF (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
+   SET(CMAKE_BUILD_TYPE RelWithDebInfo)
+ENDIF (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
 
+
 if (WIN32)
 
    if(CYGWIN)
@@ -217,8 +231,9 @@
    set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE)
    set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
    set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
-   set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-common")
-   set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -fno-exceptions -fno-check-new -fno-common")
+   # optimization flags are set further below for the various build types
+   set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+   set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common")
 endif (CMAKE_SYSTEM_NAME MATCHES Linux)
 
 
@@ -227,8 +242,9 @@
    set ( _KDE4_PLATFORM_DEFINITIONS -D_GNU_SOURCE )
    set ( CMAKE_SHARED_LINKER_FLAGS "-avoid-version -lc")
    set ( CMAKE_MODULE_LINKER_FLAGS "-avoid-version -lc")
-   set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-common")
-   set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+   # optimization flags are set further below for the various build types
+   set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+   set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
 endif (CMAKE_SYSTEM_NAME MATCHES BSD)
 
 
@@ -251,8 +267,10 @@
   #set(CMAKE_SHARED_LINKER_FLAGS "-single_module -undefined dynamic_lookup -multiply_defined suppress")
   #set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup -multiply_defined suppress")
 
-  set (CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -fno-common -Os")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Os")
+  # removed -Os, was there a special reason for using -Os instead of -O2 ?, Alex
+  # optimization flags are set below for the various build types
+  set (CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -fno-common")
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common")
 endif(APPLE)
 
 
@@ -264,6 +282,13 @@
 
 if (CMAKE_COMPILER_IS_GNUCXX)
    set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
+   # Select flags.
+   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+   set(CMAKE_CXX_FLAGS_RELEASE        "-O2")
+   set(CMAKE_CXX_FLAGS_DEBUG          "-O0 -g")
+   set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
+   set(CMAKE_C_FLAGS_RELEASE          "-O2")
+   set(CMAKE_C_FLAGS_DEBUG            "-O0 -g")
 endif (CMAKE_COMPILER_IS_GNUCXX)
 
 ###########    end of platform specific stuff  ##########################
--- trunk/KDE/kdelibs/kdecore/CMakeLists.txt #511434:511435
@@ -242,6 +242,8 @@
 
 ########### next target ###############
 
+# set the variables used in kde-config.cpp.in
+
 set(prefix              ${CMAKE_INSTALL_PREFIX})
 set(datadir             ${CMAKE_INSTALL_PREFIX}${DATA_INSTALL_DIR})
 set(exec_prefix         ${CMAKE_INSTALL_PREFIX}/bin)
--- trunk/KDE/kdelibs/kio/kssl/kssl/CMakeLists.txt #511434:511435
@@ -5,7 +5,7 @@
 add_subdirectory( caroot )
 ########### install files ###############
 
-install_files( ${KDE4_CONFIG_DIR} FILES ksslcalist )
+install_files( ${CONFIG_INSTALL_DIR} FILES ksslcalist )
 
 kde4_footer()
 
--- trunk/KDE/kdelibs/kio/kssl/kssl/caroot/CMakeLists.txt #511434:511435
@@ -5,7 +5,7 @@
 
 ########### install files ###############
 
-install_files( ${KDE4_DATA_DIR}/kssl FILES ca-bundle.crt )
+install_files( ${DATA_INSTALL_DIR}/kssl FILES ca-bundle.crt )
 
 kde4_footer()
 


More information about the Kde-buildsystem mailing list