generic: build system cleanups

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2015-11-06 13:03:02 +02:00
parent fb21598cc7
commit 18a7b9c1a2
19 changed files with 306 additions and 129 deletions

View file

@ -1,5 +1,8 @@
project(kde-workspace)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include(CheckIncludeFiles)
include(CheckFunctionExists)
@ -318,6 +321,18 @@ install(
DESTINATION ${LIB_INSTALL_DIR}/cmake/KDE4Workspace
)
# run a script before installing the exports files which deletes previously installed
# configuration specific export files KDELibs4(Library|Tools)Targets-<config>.cmake
# if the main exports file KDELibs4(Library|Tools)Targets.cmake has changed. This makes sure
# that this main file doesn't include older and different configuration specific exports files,
# which might have a different set of targets or targets with different names.
# The code for installing the exports files will soon go into a macro. Alex
install(
CODE "set(EXPORT_FILES KDE4WorkspaceLibraryTargets.cmake)"
CODE "set(EXPORT_INSTALL_DIR \"${DATA_INSTALL_DIR}/cmake/modules\")"
SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/check_installed_exports_file.cmake"
)
install(
EXPORT kdeworkspaceLibraryTargets
NAMESPACE ${KDE4WORKSPACE_TARGET_PREFIX}

View file

@ -0,0 +1,73 @@
# This file is executed via install(SCRIPT).
# This means it is include()d into the cmake_install.cmake file
# Due to this the following variables already have the correct value:
# CMAKE_INSTALL_PREFIX
# CMAKE_CURRENT_BINARY_DIR
#
# Additionally the following two variables have to be set:
# EXPORT_INSTALL_DIR - set it to the install destination
# EXPORT_FILES - the filenames of the exports file
#
# Alex
# put all the code into a function so all variables used here are local
# which makes sure including this file multiple times in a cmake_install.cmake works
function(CHECK_INSTALLED_EXPORTS_FILE _filename)
# get the absolute install directory, consider absolute and relative paths and also DESTDIR
if(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
set(installDir "$ENV{DESTDIR}${EXPORT_INSTALL_DIR}")
else(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
set(installDir "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${EXPORT_INSTALL_DIR}")
endif(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
set(installedExportsFile "${installDir}/${_filename}")
#message(STATUS "************ bin dir: ${CMAKE_CURRENT_BINARY_DIR}")
#message(STATUS "************ prefix: ${CMAKE_INSTALL_PREFIX}")
#message(STATUS "************ exportsfile: ${installedExportsFile}")
# if the file already exists at the install location, and if we can
# find the exports file in the build dir, read both, and if their contents differ,
# remove all configuration-specific exports files from the install dir, since
# they may create conflicts if the new targets have been added/targets have been
# removed/ targets have been renamed/ the namespace for the exported targets has changed
if(EXISTS "${installedExportsFile}")
if (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
set(binaryDirExportFileDir "_${CMAKE_MATCH_2}")
set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${binaryDirExportFileDir}/${_filename}")
else (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${EXPORT_INSTALL_DIR}/${_filename}")
endif (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
# message(STATUS "************* binaryDirExportsFile: ${binaryDirExportsFile}")
if(EXISTS "${binaryDirExportsFile}")
file(READ "${installedExportsFile}" installedExportsFileContents)
file(READ "${binaryDirExportsFile}" binaryDirExportsFileContents)
if(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
if("${_filename}" MATCHES "^(.+)(\\.cmake)$")
message(STATUS "XXX Installed and new ${_filename} differ, removing installed ${CMAKE_MATCH_1}-*.cmake files")
file(GLOB exportFiles "${installDir}/${CMAKE_MATCH_1}-*.cmake")
# message(STATUS "XXX files: ${exportFiles}")
file(REMOVE ${exportFiles})
endif("${_filename}" MATCHES "^(.+)(\\.cmake)$")
else(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
# message(STATUS "XXX FILES ${_filename} are the same")
endif(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
endif(EXISTS "${binaryDirExportsFile}")
endif(EXISTS "${installedExportsFile}")
endfunction(CHECK_INSTALLED_EXPORTS_FILE)
# call the function for each exports file
foreach(_currentExportsFile ${EXPORT_FILES})
check_installed_exports_file("${_currentExportsFile}")
endforeach(_currentExportsFile ${EXPORT_FILES})

View file

@ -1,14 +1,15 @@
macro_optional_find_package(Freetype)
set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine"
set_package_properties(Freetype PROPERTIES
DESCRIPTION "A font rendering engine"
URL "http://www.freetype.org"
TYPE OPTIONAL
PURPOSE "Needed to build kfontinst, a simple font installer."
)
set(libkxftconfig_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/fonts/kxftconfig.cpp )
TYPE OPTIONAL
)
set(libkxftconfig_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/fonts/kxftconfig.cpp
)
if( X11_Xrandr_FOUND )
add_subdirectory( randr )

View file

@ -7,4 +7,5 @@ System Settings is not:
-System Administration/Configuration
-Tools/Utilities
On other environments the already provided equivalent should be used. In KDE the other environment equivalents should not be needed.
On other environments the already provided equivalent should be used.
In KDE the other environment equivalents should not be needed.

View file

@ -1,6 +1,5 @@
add_subdirectory( componentservices )
add_subdirectory( windowmanagers )
add_subdirectory(componentservices)
add_subdirectory(windowmanagers)
########### next target ###############
@ -16,28 +15,27 @@ set(kcm_componentchooser_SRCS
${kcm_componentchooser_SRCS}
componentchooserterminal.cpp
ktimerdialog.cpp
browserconfig_ui.ui
filemanagerconfig_ui.ui
emailclientconfig_ui.ui
componentchooser_ui.ui
componentconfig_ui.ui
terminalemulatorconfig_ui.ui
wmconfig_ui.ui
)
if(Q_WS_X11)
set(kcm_componentchooser_SRCS ${kcm_componentchooser_SRCS}
componentchooserwm.cpp )
endif(Q_WS_X11)
set(kcm_componentchooser_SRCS
${kcm_componentchooser_SRCS}
componentchooserwm.cpp
)
endif()
kde4_add_plugin(kcm_componentchooser ${kcm_componentchooser_SRCS})
target_link_libraries(kcm_componentchooser ${KDE4_KIO_LIBS})
install(TARGETS kcm_componentchooser DESTINATION ${PLUGIN_INSTALL_DIR} )
install(
TARGETS kcm_componentchooser
DESTINATION ${PLUGIN_INSTALL_DIR}
)
########### install files ###############
install(FILES componentchooser.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(
FILES componentchooser.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -1,3 +1,9 @@
install( FILES kcm_kemail.desktop kcm_browser.desktop
kcm_filemanager.desktop kcm_terminal.desktop kcm_wm.desktop
DESTINATION ${DATA_INSTALL_DIR}/kcm_componentchooser )
install(
FILES
kcm_kemail.desktop
kcm_browser.desktop
kcm_filemanager.desktop
kcm_terminal.desktop
kcm_wm.desktop
DESTINATION ${DATA_INSTALL_DIR}/kcm_componentchooser
)

View file

@ -1,5 +1,11 @@
########### install files ###############
file(GLOB desktop_file "*.desktop")
install( FILES ${desktop_file}
DESTINATION ${DATA_INSTALL_DIR}/ksmserver/windowmanagers )
install(
FILES
compiz-custom.desktop
compiz.desktop
marco.desktop
metacity.desktop
openbox.desktop
DESTINATION ${DATA_INSTALL_DIR}/ksmserver/windowmanagers
)

View file

@ -1,20 +1,41 @@
########### next target ###############
set(kcm_clock_PART_SRCS dtime.cpp main.cpp dateandtime.ui)
set(kcm_clock_PART_SRCS
dtime.cpp
main.cpp
)
kde4_add_plugin(kcm_clock ${kcm_clock_PART_SRCS})
target_link_libraries(kcm_clock ${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS} )
target_link_libraries(kcm_clock
${KDE4_KIO_LIBS}
${KDE4_PLASMA_LIBS}
)
install(TARGETS kcm_clock DESTINATION ${PLUGIN_INSTALL_DIR} )
install(
TARGETS kcm_clock
DESTINATION ${PLUGIN_INSTALL_DIR}
)
########### next target ###############
add_executable(kcmdatetimehelper helper.cpp ${helper_mocs})
target_link_libraries(kcmdatetimehelper ${KDE4_KDECORE_LIBS})
install(TARGETS kcmdatetimehelper DESTINATION ${LIBEXEC_INSTALL_DIR})
add_executable(kcmdatetimehelper helper.cpp)
kde4_install_auth_helper_files(kcmdatetimehelper org.kde.kcontrol.kcmclock root)
target_link_libraries(kcmdatetimehelper ${KDE4_KDECORE_LIBS})
install(
TARGETS kcmdatetimehelper
DESTINATION ${LIBEXEC_INSTALL_DIR}
)
kde4_install_auth_helper_files(
kcmdatetimehelper
org.kde.kcontrol.kcmclock
root
)
########### install files ###############
install( FILES clock.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install(
FILES clock.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -5,8 +5,17 @@ set(kcm_desktoppaths_PART_SRCS
kde4_add_plugin(kcm_desktoppaths ${kcm_desktoppaths_PART_SRCS})
target_link_libraries(kcm_desktoppaths ${KDE4_KCMUTILS_LIBS} ${KDE4_KIO_LIBS})
target_link_libraries(kcm_desktoppaths
${KDE4_KCMUTILS_LIBS}
${KDE4_KIO_LIBS}
)
install(TARGETS kcm_desktoppaths DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES desktoppath.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(
TARGETS kcm_desktoppaths
DESTINATION ${PLUGIN_INSTALL_DIR}
)
install(
FILES desktoppath.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -4,8 +4,6 @@ set(kcmdesktoptheme_SRCS
kcmdesktoptheme.cpp
desktopthemedetails.cpp
thememodel.cpp
DesktopTheme.ui
DesktopThemeDetails.ui
)
kde4_add_plugin(kcm_desktoptheme ${kcmdesktoptheme_SRCS})
@ -18,9 +16,15 @@ target_link_libraries(kcm_desktoptheme
${KDE4_KIO_LIBS}
)
install(TARGETS kcm_desktoptheme DESTINATION ${PLUGIN_INSTALL_DIR})
install(
TARGETS kcm_desktoptheme
DESTINATION ${PLUGIN_INSTALL_DIR}
)
########### install files ###############
install(FILES desktoptheme.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(
FILES desktoptheme.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -1,18 +1,20 @@
########### next target ###############
set(kcm_kdnssd_PART_SRCS kcmdnssd.cpp kcmdnssd.h configdialog.ui)
kde4_add_plugin(kcm_kdnssd kcmdnssd.cpp)
kde4_add_plugin(kcm_kdnssd ${kcm_kdnssd_PART_SRCS})
target_link_libraries(kcm_kdnssd ${KDE4_KDNSSD_LIBS} ${KDE4_KDEUI_LIBS})
install(TARGETS kcm_kdnssd DESTINATION ${PLUGIN_INSTALL_DIR})
target_link_libraries(kcm_kdnssd
${KDE4_KDNSSD_LIBS}
${KDE4_KDEUI_LIBS}
)
install(
TARGETS kcm_kdnssd
DESTINATION ${PLUGIN_INSTALL_DIR}
)
########### install files ###############
install(FILES kcm_kdnssd.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(
FILES kcm_kdnssd.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -1,10 +1,23 @@
set(kcmemoticons_SRCS emoticonslist.cpp emoticonslist.ui)
kde4_add_plugin(kcm_emoticons emoticonslist.cpp)
kde4_add_plugin(kcm_emoticons ${kcmemoticons_SRCS})
target_link_libraries(kcm_emoticons ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KEMOTICONS_LIBRARY})
install(TARGETS kcm_emoticons DESTINATION ${PLUGIN_INSTALL_DIR} )
target_link_libraries(kcm_emoticons
${KDE4_KDEUI_LIBS}
${KDE4_KPARTS_LIBS}
${KDE4_KEMOTICONS_LIBRARY}
)
########### install files ###############
install( FILES emoticons.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES emoticons.knsrc DESTINATION ${CONFIG_INSTALL_DIR} )
install(
TARGETS kcm_emoticons
DESTINATION ${PLUGIN_INSTALL_DIR}
)
install(
FILES emoticons.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)
install(
FILES emoticons.knsrc
DESTINATION ${CONFIG_INSTALL_DIR}
)

View file

@ -5,16 +5,25 @@ include_directories(${FREETYPE_INCLUDE_DIRS})
########### next target ###############
set(kcm_fonts_PART_SRCS ../krdb/krdb.cpp fonts.cpp)
set(kcm_fonts_PART_SRCS
../krdb/krdb.cpp
fonts.cpp
)
if(Q_WS_X11)
set(kcm_fonts_PART_SRCS ${kcm_fonts_PART_SRCS} ${libkxftconfig_SRCS})
set(kcm_fonts_PART_SRCS
${kcm_fonts_PART_SRCS}
${libkxftconfig_SRCS}
)
endif(Q_WS_X11)
kde4_add_plugin(kcm_fonts ${kcm_fonts_PART_SRCS})
target_link_libraries(kcm_fonts ${KDE4_KDEUI_LIBS} ${FREETYPE_LIBRARIES} ${QT_QTXML_LIBRARY})
target_link_libraries(kcm_fonts
${KDE4_KDEUI_LIBS}
${FREETYPE_LIBRARIES}
${QT_QTXML_LIBRARY}
)
if(Q_WS_X11)
if(FONTCONFIG_FOUND)
@ -24,9 +33,14 @@ if(Q_WS_X11)
target_link_libraries(kcm_fonts ${X11_LIBRARIES})
endif(Q_WS_X11)
install(TARGETS kcm_fonts DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES fonts.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install(
TARGETS kcm_fonts
DESTINATION ${PLUGIN_INSTALL_DIR}
)
install(
FILES fonts.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -1,9 +1,6 @@
add_subdirectory(display)
add_subdirectory( display )
if (CMAKE_SYSTEM_NAME MATCHES Linux)
if(CMAKE_SYSTEM_NAME MATCHES Linux)
# this one doesn't seem to be very portable, Alex
add_subdirectory( joystick )
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
add_subdirectory(joystick)
endif()

View file

@ -1,19 +1,21 @@
########### next target ###############
set(kcm_display_PART_SRCS display.cpp )
kde4_add_plugin(kcm_display display.cpp)
target_link_libraries(kcm_display
${KDE4_KCMUTILS_LIBS}
${QT_QTGUI_LIBRARY}
${KDE4_KDEUI_LIBS}
)
kde4_add_plugin(kcm_display ${kcm_display_PART_SRCS})
target_link_libraries(kcm_display ${KDE4_KCMUTILS_LIBS} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS})
install(TARGETS kcm_display DESTINATION ${PLUGIN_INSTALL_DIR} )
install(
TARGETS kcm_display
DESTINATION ${PLUGIN_INSTALL_DIR}
)
########### install files ###############
install( FILES display.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install(
FILES display.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -1,6 +1,3 @@
########### next target ###############
set(kcm_joystick_PART_SRCS
@ -8,19 +5,25 @@ set(kcm_joystick_PART_SRCS
joywidget.cpp
poswidget.cpp
joydevice.cpp
caldialog.cpp )
caldialog.cpp
)
kde4_add_plugin(kcm_joystick ${kcm_joystick_PART_SRCS})
target_link_libraries(kcm_joystick ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${QT_QTGUI_LIBRARY})
install(TARGETS kcm_joystick DESTINATION ${PLUGIN_INSTALL_DIR} )
target_link_libraries(kcm_joystick
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${QT_QTGUI_LIBRARY}
)
########### install files ###############
install( FILES joystick.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install(
TARGETS kcm_joystick
DESTINATION ${PLUGIN_INSTALL_DIR}
)
#
install(
FILES joystick.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)

View file

@ -4,16 +4,28 @@ endif()
########### next target ###############
set(kcm_icons_PART_SRCS iconthemes.cpp icons.cpp main.cpp)
set(kcm_icons_PART_SRCS
iconthemes.cpp
icons.cpp
main.cpp
)
kde4_add_plugin(kcm_icons ${kcm_icons_PART_SRCS})
target_link_libraries(kcm_icons ${KDE4_KIO_LIBS})
install(TARGETS kcm_icons DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
install(FILES icons.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES icons.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
install(
TARGETS kcm_icons
DESTINATION ${PLUGIN_INSTALL_DIR}
)
install(
FILES icons.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)
install(
FILES icons.knsrc
DESTINATION ${CONFIG_INSTALL_DIR}
)

View file

@ -1,12 +1,12 @@
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )
########### next target ###############
set(testicons_SRCS testicons.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../icons.cpp )
set(testicons_SRCS
testicons.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../icons.cpp
)
kde4_add_manual_test(testicons ${testicons_SRCS})
target_link_libraries(testicons ${KDE4_KDEUI_LIBS})

View file

@ -3,7 +3,7 @@ add_subdirectory( pics )
########### next target ###############
set(kcm_locale_PART_SRCS kcmlocale.cpp kcmlocalewidget.ui )
set(kcm_locale_PART_SRCS kcmlocale.cpp )
kde4_add_plugin(kcm_locale ${kcm_locale_PART_SRCS})