cmake_minimum_required ( VERSION 2.8 )
##### general package setup #####################
project ( gtk-qt-engine )
set ( PACKAGE gtk-qt-engine )
set ( VERSION R14.1.0 )
##### include essential cmake modules ###########
include ( FindPkgConfig )
include ( CheckIncludeFile )
include ( CheckCSourceRuns )
include ( CheckCXXSourceCompiles )
include ( CheckLibraryExists )
include ( CheckFunctionExists )
include ( CheckStructHasMember )
##### include our cmake modules #################
set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include ( TDEMacros )
##### setup install paths #######################
include ( TDESetupPaths )
tde_setup_paths ( )
##### set PKG_CONFIG_PATH #######################
set ( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}:${LIB_INSTALL_DIR}/pkgconfig" )
##### configure checks ##########################
include ( ConfigureChecks.cmake )
###### global compiler settings #################
add_definitions (
- D H A V E _ C O N F I G _ H
)
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
INCLUDE ( UsePkgConfig )
# Find GTK
PKGCONFIG ( gtk+-2.0 GTK_INCLUDE_DIR GTK_LIB_DIR GTK_LINK_FLAGS GTK_CFLAGS )
IF ( NOT GTK_INCLUDE_DIR )
MESSAGE ( FATAL_ERROR "GTK was not found. Ensure you have the GTK development libraries installed, and GTK's pkgconfig files are in your pkgconfig search path." )
ENDIF ( NOT GTK_INCLUDE_DIR )
MESSAGE ( STATUS "Found GTK include dir: ${GTK_INCLUDE_DIR}" )
MESSAGE ( STATUS "Found GTK library dir: ${GTK_LIB_DIR}" )
# Find Bonobo
PKGCONFIG ( libbonoboui-2.0 BONOBO_INCLUDE_DIR BONOBO_LIB_DIR BONOBO_LINK_FLAGS BONOBO_CFLAGS )
IF ( NOT BONOBO_INCLUDE_DIR )
MESSAGE ( STATUS "bonoboui not found. Some features of the theme engine will not work as intended." )
ELSE ( NOT BONOBO_INCLUDE_DIR )
MESSAGE ( STATUS "Found Bonobo include dir: ${BONOBO_INCLUDE_DIR}" )
MESSAGE ( STATUS "Found Bonobo library dir: ${BONOBO_LIB_DIR}" )
SET ( BONOBO_DEFINITIONS -D HAVE_BONOBO )
ENDIF ( NOT BONOBO_INCLUDE_DIR )
# Find msgfmt
SET ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /CMake/Modules )
FIND_PACKAGE ( Msgfmt REQUIRED )
# Find xgettext
FIND_PROGRAM (
X G E T T E X T _ P A T H
N A M E S " x g e t t e x t "
P A T H S " / u s r / b i n "
)
IF ( ${ XGETTEXT_PATH } STREQUAL "XGETTEXT_PATH-NOTFOUND" )
MESSAGE ( STATUS "xgettext not found. You will not be able to run 'make extract_messages' in the 'po' directory." )
ELSE ( ${ XGETTEXT_PATH } STREQUAL "XGETTEXT_PATH-NOTFOUND" )
MESSAGE ( STATUS "Found xgettext: ${XGETTEXT_PATH}" )
ENDIF ( ${ XGETTEXT_PATH } STREQUAL "XGETTEXT_PATH-NOTFOUND" )
# Find extractrc
FIND_PROGRAM (
E X T R A C T R C _ P A T H
N A M E S " e x t r a c t r c "
P A T H S " / u s r / b i n "
)
IF ( ${ EXTRACTRC_PATH } STREQUAL "EXTRACTRC_PATH-NOTFOUND" )
MESSAGE ( STATUS "extractrc not found. You will not be able to run 'make extract_messages' in the 'po' directory." )
ELSE ( ${ EXTRACTRC_PATH } STREQUAL "EXTRACTRC_PATH-NOTFOUND" )
MESSAGE ( STATUS "Found extractrc: ${EXTRACTRC_PATH}" )
ENDIF ( ${ EXTRACTRC_PATH } STREQUAL "EXTRACTRC_PATH-NOTFOUND" )
# Work out where to install stuff
EXEC_PROGRAM (
$ { P K G C O N F I G _ E X E C U T A B L E }
A R G S - - v a r i a b l e = g t k _ b i n a r y _ v e r s i o n g t k + - 2 . 0
O U T P U T _ V A R I A B L E G T K _ V E R S I O N )
SET ( INSTALL_PATH_GTK_ENGINES "${GTK_LIB_DIR}/gtk-2.0/${GTK_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library (eg. /usr/lib/gtk-2.0/2.4.0/engines)" )
MESSAGE ( STATUS "Installing the GTK theme engine library to: ${INSTALL_PATH_GTK_ENGINES}" )
EXEC_PROGRAM (
$ { P K G C O N F I G _ E X E C U T A B L E }
A R G S - - v a r i a b l e = p r e f i x g t k + - 2 . 0
O U T P U T _ V A R I A B L E G T K _ P R E F I X )
SET ( INSTALL_PATH_GTK_THEMES "${GTK_PREFIX}/share/themes" CACHE PATH "The directory in which to install the theme data (eg. /usr/share/themes)" )
MESSAGE ( STATUS "Installing the GTK theme engine data to: ${INSTALL_PATH_GTK_THEMES}" )
SET ( INSTALL_PATH_KCONTROL_MODULES "${TDE_LIB_DIR}" CACHE PATH "The directory in which to install KControl plugins (eg. /usr/lib)" )
MESSAGE ( STATUS "Installing the KControl plugins to: ${INSTALL_PATH_KCONTROL_MODULES}" )
MESSAGE ( STATUS "Installing everything else to: ${CMAKE_INSTALL_PREFIX}" )
# Setup definitions and directories to be used in all subdirectories
ADD_DEFINITIONS ( ${ QT_DEFINITIONS } ${ TDE_DEFINITIONS } ${ BONOBO_DEFINITIONS } )
LINK_DIRECTORIES ( ${ TDE_LIB_DIR } ${ GTK_LIB_DIR } ${ BONOBO_LIB_DIR } ${ TQT_LIBRARY_DIRS } )
INCLUDE_DIRECTORIES ( ${ GTK_INCLUDE_DIR } ${ BONOBO_INCLUDE_DIR } ${ TDE_INCLUDE_DIR } ${ TQT_INCLUDE_DIRS } )
# Subdirectories
ADD_SUBDIRECTORY ( src )
ADD_SUBDIRECTORY ( kcm_gtk )
ADD_SUBDIRECTORY ( po )
ADD_SUBDIRECTORY ( doc )
# Uninstall support
CONFIGURE_FILE (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
ADD_CUSTOM_TARGET ( uninstall
" $ { C M A K E _ C O M M A N D } " - P " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e " )