Browse Source

[dependencies/tqtinterface] improved setup paths; better Qt setup

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/tqtinterface@1214898 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
tags/v3.5.13
samelian 9 years ago
parent
commit
722704e00c
1 changed files with 48 additions and 31 deletions
  1. +48
    -31
      CMakeLists.txt

+ 48
- 31
CMakeLists.txt View File

@@ -17,40 +17,52 @@ set( TQT_MINOR_VERSION 5 )
set( TQT_MICRO_VERSION 12 )
set( TQT_VERSION "${TQT_MAJOR_VERSION}.${TQT_MINOR_VERSION}.${TQT_MICRO_VERSION}" )

if( BUILD_QT4 )
find_package( Qt4 REQUIRED )
set( QT_VER 4 )
else( BUILD_QT4 )
set( QT_MT_REQUIRED TRUE )
find_package( Qt3 REQUIRED )
set( QT_VER 3 )
endif( BUILD_QT4 )
##### include essential cmake modules ###########

include( CheckCXXSourceCompiles )

##### paths setup ###############################

if( NOT BIN_INSTALL_DIR )
set( BIN_INSTALL_DIR bin )
endif ( NOT BIN_INSTALL_DIR )
##### include our cmake modules #################

if( NOT LIB_INSTALL_DIR )
set( LIB_INSTALL_DIR lib )
endif( NOT LIB_INSTALL_DIR )
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )

if( NOT INCLUDE_INSTALL_DIR )
set( INCLUDE_INSTALL_DIR include/tqt )
endif( NOT INCLUDE_INSTALL_DIR )

if( NOT PKGCONFIG_INSTALL_DIR )
set( PKGCONFIG_INSTALL_DIR lib/pkgconfig )
endif( NOT PKGCONFIG_INSTALL_DIR )
##### select Qt version #########################

option( WITH_QT3 "Enable Qt3 support" OFF )
option( WITH_QT4 "Enable Qt4 support" OFF )

if( WITH_QT3 AND WITH_QT4 )
tde_message_fatal( "You must select only one Qt version, not both" )
elseif( WITH_QT3 )
find_package( Qt )
set( QT_VER 3 )
elseif( WITH_QT4 )
tde_message_fatal( "Qt4 support is not implemented yet" )
find_package( Qt4 REQUIRED )
set( QT_VER 4 )
else( )
tde_message_fatal( "You must select a Qt version" )
endif( )


##### paths setup ###############################

macro( _tde_internal_setup_path _path _default )
if( DEFINED ${_path} )
set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE )
else( )
set( ${_path} "${_default}" )
endif( )
endmacro( _tde_internal_setup_path )

_tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
_tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" )
_tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )

include_directories(
${CMAKE_CURRENT_BINARY_DIR}/qtinterface # for tqt.h
${CMAKE_CURRENT_SOURCE_DIR}/qtinterface
${QT_INCLUDE_DIR}
)

set( tqt_TOOLS
qtinterface/moc-tqt
@@ -67,7 +79,7 @@ set( tqt_TOOLS
)

set( tqt_INCS
${CMAKE_CURRENT_BINARY_DIR}/qtinterface/tqt.h
qtinterface/tqt.h
qtinterface/tqaccel.h
qtinterface/tqaccessible.h
qtinterface/tqaction.h
@@ -700,24 +712,29 @@ endif( NOT WITHOUT_INPUTCONTEXT )
configure_file( qtinterface/tmoc.cmake qtinterface/tmoc @ONLY )
configure_file( qtinterface/tqt-replace.cmake qtinterface/tqt-replace @ONLY )
configure_file( qtinterface/tqt-replace-stream.cmake qtinterface/tqt-replace-stream @ONLY )
configure_file( qtinterface/tqt.h.cmake qtinterface/tqt.h @ONLY )

add_definitions( ${QT_DEFINITIONS} )
add_definitions( ${QT_DEFINITIONS} -DUSE_QT${QT_VER} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/qtinterface ${QT_INCLUDE_DIRS} )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
link_directories( ${QT_LIBRARY_DIRS} )

add_library( tqt SHARED ${tqt_SRCS} )
set_target_properties( tqt PROPERTIES VERSION 4.2.0 SOVERSION 4 )
target_link_libraries( tqt ${QT_LIBRARIES} )


### FIXME Follow thing must be rewritten from scratch

##### split QT_DEFINITIONS and QT_LIBRARIES for using in TQt.pc

set( PKGCONFIG_QT_DEFINITIONS "-DUSE_QT${QT_VER}" )
foreach( DEF ${QT_DEFINITIONS} )
set( PKGCONFIG_QT_DEFINITIONS "${PKGCONFIG_QT_DEFINITIONS} ${DEF}" )
endforeach( DEF ${QT_DEFINITIONS} )

# a pretty ugly hack for extracting Qt library parameters
get_filename_component( QT_LIBRARY_DIR ${QT_QT_LIBRARY} PATH )
set( PKGCONFIG_QT_LIBRARIES "-L${QT_LIBRARY_DIR}" )
get_filename_component( QT_LIBRARY_DIR ${QT_LIBRARY_DIRS} PATH )
set( PKGCONFIG_QT_LIBRARIES "-L${QT_LIBRARY_DIRS}" )
foreach( LIB ${QT_LIBRARIES} )
get_filename_component( LIB ${LIB} NAME_WE )
string( REGEX REPLACE "^lib" "" LIB ${LIB} )


Loading…
Cancel
Save