summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 032ec8aec2feb5dd169ba2d51bfc8fb1bedb093e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
project(QtCurve-KDE3)
cmake_minimum_required(VERSION 2.4.0)

set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_GENERATOR "DEB;RPM;TGZ")
set(DEBIAN_PACKAGE_DESCRIPTION "QtCurve for Qt3/KDE3")
set(DEBIAN_PACKAGE_SECTION "kde")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "6")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_CONTACT "Craig Drummond <craig.p.drummond@gmail.com>")
set(QTCURVE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}")
include(CPack)

if(COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

if (QTC_BUILD_CONFIG_MODULE)
    if (NOT QTC_QT_ONLY)
        find_package(KDE3)
        if (NOT KDE3_FOUND)
            set(QTC_QT_ONLY true)
            message("INFO: KDE3 not found! Compiling for Qt only! (Not building the config module)")
        endif (NOT KDE3_FOUND)
    endif (NOT QTC_QT_ONLY)
else (QTC_BUILD_CONFIG_MODULE)
    set(QTC_QT_ONLY true)
endif (QTC_BUILD_CONFIG_MODULE)

if (NOT QTC_QT_ONLY)
    include(KDE3Macros)
else (NOT QTC_QT_ONLY)
    set(QT_MT_REQUIRED TRUE)
    find_package(Qt3 REQUIRED)
    set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
    include(QtCurveQt3)
    if (QT_PLUGINS_DIR MATCHES NOTFOUND)
      MESSAGE(STATUS_ERROR "Qt3 package not found--assuming TQt4")
      SET(QT_INCLUDE_DIR "/usr/include/qt4")
    endif (QT_PLUGINS_DIR MATCHES NOTFOUND)
endif (NOT QTC_QT_ONLY)

if (NOT QTC_QT_ONLY)
exec_program(kde-config
             ARGS --prefix --expandvars
             OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX)
endif (NOT QTC_QT_ONLY)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/tqt -include tqt.h -DTQT_THREAD_SUPPORT")

# NASTY HACK TO FORCE COMPILATION
# REMOVE WHEN FIXED
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/opt/trinity/include")

SET(QT_UIC_EXECUTABLE "/usr/bin/uic-tqt" CACHE FILEPATH "")
SET(QT_MOC_EXECUTABLE "/usr/bin/tmoc" CACHE FILEPATH "")

exec_program(kde-config
             ARGS --install locale --expandvars
             OUTPUT_VARIABLE KDE3_LOCALE_PREFIX)

file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)

# For KDE4 kde-config has been renamed to kde4-config
find_program(KDE4_KDECONFIG_EXECUTABLE
             NAMES kde4-config
             PATHS ${CMAKE_INSTALL_PREFIX}/bin ${_KDEDIRS} /usr/local/bin /usr/bin /opt/kde4/bin NO_DEFAULT_PATH)

if (NOT KDE4_KDECONFIG_EXECUTABLE)
   find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config )
endif (NOT KDE4_KDECONFIG_EXECUTABLE)

if(KDE4_KDECONFIG_EXECUTABLE)
    exec_program(${KDE4_KDECONFIG_EXECUTABLE}
                 ARGS --prefix
                 OUTPUT_VARIABLE KDE4PREFIX)
endif(KDE4_KDECONFIG_EXECUTABLE)

if(NOT KDE4PREFIX)
    set(KDE4PREFIX ${KDE3PREFIX})
endif(NOT KDE4PREFIX)

configure_file (config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
if (NOT QTC_QT_ONLY)
    add_definitions(${QT_DEFINITIONS} ${KDE3_DEFINITIONS})
    include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDES})
else (NOT QTC_QT_ONLY)
    add_definitions(${QT_DEFINITIONS})
    include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
endif (NOT QTC_QT_ONLY)

set(DATA_INSTALL_DIR ${KDE3PREFIX}/share/apps)

if(QTC_DEFAULT_TO_KDE3)
    message("INFO: Defaulting to reading KDE3 settings if KDE_SESSION_VERSION is not set")
else(QTC_DEFAULT_TO_KDE3)
    message("INFO: Defaulting to reading KDE4 settings if KDE_SESSION_VERSION is not set")
endif(QTC_DEFAULT_TO_KDE3)

add_subdirectory(style)
if (NOT QTC_QT_ONLY)
    if (QTC_BUILD_CONFIG_MODULE)
        message("**************************************************************\n"
                "Warning: The KDE3 config module is deprecated, and is no longer\n"
                "         actively maintained. This module NO LONGER COMPILES!\n"
                "         It is recommended to use the KDE4 version instead.\n"
                "**************************************************************\n")
        add_subdirectory(config)
        add_subdirectory(po)
    endif (QTC_BUILD_CONFIG_MODULE)
    add_subdirectory(themes)
    add_subdirectory(colors)
endif (NOT QTC_QT_ONLY)

if (QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT)
    message("**************************************************************\n"
            "Warning: You have enabled support for the 'fix parentless dialogs'\n"
            "         option. This is known to BREAK some applications. Please\n"
            "         DO NOT report errors to application authors when you have\n"
            "         this enabled. Please reconsider DISABLING this option.\n"
            "**************************************************************\n")
endif (QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT)