summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 5fbcd229bfab75b6b15e3cb939afc26f200affc8 (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
128
129
130
131
132
133
134
135
136
137
PROJECT(tdesvn)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
SET(BASE_VERSION 1.0.4)

OPTION(BUILD_TESTS "Building the tests yes or no (default off)")
OPTION(DAILY_BUILD "Generate version number for a daily build (default off)")

SET(TESTINGBUILD OFF CACHE BOOL "Enable/Disable special testing flags")
IF (TESTINGBUILD)
   ADD_DEFINITIONS("-DTESTING_RC=\"\\\"\${CMAKE_SOURCE_DIR}/src/tdesvnui.rc\\\"\" -DTESTING_PARTRC=\"\\\"\${CMAKE_SOURCE_DIR}/src/tdesvn_part.rc\\\"\"")
   ADD_DEFINITIONS("-DFORCE_ASKPASS=\"\\\"\${CMAKE_BINARY_DIR}/bin/tdesvnaskpass\\\"\"")
ENDIF (TESTINGBUILD)

IF(BUILD_TESTS)
  ENABLE_TESTING()
ENDIF(BUILD_TESTS)

SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmakemodules ${CMAKE_SOURCE_DIR}/src/svnqt/cmakemodules)

INCLUDE(FindKdeLibs)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/trinity/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/trinity/lib${LIB_SUFFIX}/trinity)

INCLUDE(MacroEnsureVersion)
INCLUDE(FindSubversion)
INCLUDE(SetupCompiler)
INCLUDE(FindSqlite)

IF(QT_INCLUDE_DIR)
ELSE(QT_INCLUDE_DIR)
    MESSAGE(STATUS_ERROR "Qt3 package not found--assuming TQt4")
    SET(QT_INCLUDE_DIR "/usr/include/qt4")
ENDIF(QT_INCLUDE_DIR)

IF (HAVE_GCC_VISIBILITY)
    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
    SET(_KDESVN_EXPORT "__attribute__ ((visibility(\"default\")))")
    SET(_KDESVN_NOEXPORT "__attribute__ ((visibility(\"hidden\")))")
ENDIF (HAVE_GCC_VISIBILITY)

INCLUDE_DIRECTORIES (
    BEFORE
    ${CMAKE_SOURCE_DIR}/src/svnqt
)

INCLUDE_DIRECTORIES (
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_SOURCE_DIR}/src/svnfrontend
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/src
    ${CMAKE_BINARY_DIR}/src/svnfrontend
    ${CMAKE_BINARY_DIR}
    ${KDE3_INCLUDE_DIR}
    ${QT_INCLUDE_DIR}
    ${APR_INCLUDE_DIR}
    ${APU_INCLUDE_DIR}
    ${SUBVERSION_INCLUDE_DIR}
)

ADD_DEFINITIONS(${KDE3_DEFINITIONS} ${QT_DEFINITIONS} ${APR_CPP_FLAGS})

IF(CMAKE_BUILD_TYPE MATCHES Debug)
  # FindKde3 always make a "-O2" into it. That isn't nice.
  STRING(REGEX REPLACE "-O2 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
STRING(REGEX REPLACE "-fno-exceptions " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/trinity/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/trinity/lib${LIB_SUFFIX}/trinity)
SET(_BASE_LDADD "-L${CMAKE_BINARY_DIR}/trinity/lib${LIB_SUFFIX}")

# current version
IF (DAILY_BUILD)
    EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILDDATE)
    STRING(REPLACE "\n" "" BUILDDATE ${BUILDDATE})
    SET(VERSION "${BASE_VERSION}.${BUILDDATE}")
    SET(KDESVN_VERSION "\"${BASE_VERSION}-${BUILDDATE}\"")
ELSE(DAILY_BUILD)
    SET(VERSION "$ENV{KDESVN_VERSION}")
    IF(NOT VERSION)
        SET(VERSION ${BASE_VERSION})
    ENDIF(NOT VERSION)
    SET(KDESVN_VERSION \"${VERSION}\")
ENDIF(DAILY_BUILD)

CONFIGURE_FILE(tdesvn-config.h.in tdesvn-config.h @ONLY)
CONFIGURE_FILE(tdesvn.spec.in tdesvn.spec @ONLY)
CONFIGURE_FILE(Helperstuff/BuildService/tdesvn.spec.in Helperstuff/BuildService/tdesvn.spec @ONLY)
CONFIGURE_FILE(Helperstuff/BuildService/tdesvn.dsc.in Helperstuff/BuildService/tdesvn.dsc @ONLY)
CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
CONFIGURE_FILE(Doxyfile.svnqt.in Doxyfile.svnqt @ONLY)

SET(DIST_EXCLUDE "Helperstuff/pic_design")
CONFIGURE_FILE(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/makedist.sh.in"
    "${CMAKE_CURRENT_BINARY_DIR}/makedist.sh"
    IMMEDIATE
    @ONLY)


CONFIGURE_FILE(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY)

ADD_CUSTOM_TARGET(uninstall
    "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

ADD_CUSTOM_TARGET(dist
    "${CMAKE_BINARY_DIR}/makedist.sh"
    DEPENDS doc
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

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

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(po)
ADD_SUBDIRECTORY(doc)

FILE(GLOB _POFILES po/*.po)
FOREACH(_p ${_POFILES})
  SET(POFILES "${_p} ${POFILES}")
ENDFOREACH(_p)

SET(MESSAGES_DIR ${CMAKE_SOURCE_DIR}/src)
CONFIGURE_FILE(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/package_messages.sh.in"
    "${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh"
    IMMEDIATE
    @ONLY)
ADD_CUSTOM_TARGET(package-messages
    "${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh")

ADD_CUSTOM_TARGET(apidox
    "doxygen" "${CMAKE_BINARY_DIR}/Doxyfile"
    DEPENDS "${CMAKE_BINARY_DIR}/Doxyfile")