summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 588d7ea190e75bde8a9e4af588819e15180c54d8 (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
PROJECT(kdesvn)
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/kdesvnui.rc\\\"\" -DTESTING_PARTRC=\"\\\"\${CMAKE_SOURCE_DIR}/src/kdesvn_part.rc\\\"\"")
   ADD_DEFINITIONS("-DFORCE_ASKPASS=\"\\\"\${CMAKE_BINARY_DIR}/bin/kdesvnaskpass\\\"\"")
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}/kde3/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/kde3/lib${LIB_SUFFIX}/kde3)

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

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}/kde3/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/kde3/lib${LIB_SUFFIX}/kde3)
SET(_BASE_LDADD "-L${CMAKE_BINARY_DIR}/kde3/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(kdesvn-config.h.in kdesvn-config.h @ONLY)
CONFIGURE_FILE(kdesvn.spec.in kdesvn.spec @ONLY)
CONFIGURE_FILE(Helperstuff/BuildService/kdesvn.spec.in Helperstuff/BuildService/kdesvn.spec @ONLY)
CONFIGURE_FILE(Helperstuff/BuildService/kdesvn.dsc.in Helperstuff/BuildService/kdesvn.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})


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")