utils/makerpm: Fix building of RPMs
[skype-call-recorder.git] / CMakeLists.txt
blob2e5ed1775946c8b000b6b11bfbc68c8ccd58e464
2 # versions before 2.4.8 do not seem to know about Qt's DBus
3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.8 FATAL_ERROR)
5 PROJECT(skype-call-recorder)
6 SET(TARGET skype-call-recorder)
8 SET(CMAKE_BUILD_TYPE RELEASE)
9 #SET(CMAKE_BUILD_TYPE DEBUG)
11 # compiler flags
13 SET(CMAKE_CXX_FLAGS "-Wall -W -pipe -fno-exceptions")
14 SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb")
15 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -s")
17 # sources
19 SET(SOURCES
20         call.cpp
21         common.cpp
22         gui.cpp
23         mp3writer.cpp
24         preferences.cpp
25         recorder.cpp
26         skype.cpp
27         trayicon.cpp
28         utils.cpp
29         version.cpp
30         vorbiswriter.cpp
31         wavewriter.cpp
32         writer.cpp
35 SET(MOC_HEADERS
36         call.h
37         gui.h
38         preferences.h
39         recorder.h
40         skype.h
41         smartwidgets.h
42         trayicon.h
45 SET(RESOURCES resources.qrc)
47 # generation of version.cpp
49 ADD_CUSTOM_TARGET(Version
50         ${CMAKE_CURRENT_SOURCE_DIR}/makeversion ${CMAKE_CURRENT_SOURCE_DIR}
51         COMMENT "Checking version.cpp" VERBATIM)
52 SET_SOURCE_FILES_PROPERTIES(version.cpp PROPERTIES GENERATED TRUE)
53 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES version.cpp)
54 # required when building out of source, so version.cpp finds headers
55 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
57 # external libraries
59 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
60 SET(LIBRARIES)
62 # lame
64 FIND_PACKAGE(lame REQUIRED)
65 INCLUDE_DIRECTORIES(${LAME_INCLUDE_DIR})
66 SET(LIBRARIES ${LIBRARIES} ${LAME_LIBRARY})
68 # id3
70 FIND_PACKAGE(id3 REQUIRED)
71 INCLUDE_DIRECTORIES(${ID3_INCLUDE_DIR})
72 SET(LIBRARIES ${LIBRARIES} ${ID3_LIBRARY})
74 # vorbisenc
76 FIND_PACKAGE(vorbisenc REQUIRED)
77 INCLUDE_DIRECTORIES(${VORBISENC_INCLUDE_DIR})
78 SET(LIBRARIES ${LIBRARIES} ${VORBISENC_LIBRARY})
80 # Qt
82 SET(QT_USE_QTDBUS TRUE)
83 SET(QT_USE_QTNETWORK TRUE)
84 FIND_PACKAGE(Qt4 REQUIRED)
85 INCLUDE(${QT_USE_FILE})
86 SET(LIBRARIES ${LIBRARIES} ${QT_LIBRARIES})
87 QT4_WRAP_CPP(MOC_SOURCES ${MOC_HEADERS})
88 QT4_ADD_RESOURCES(RESOURCES_SOURCES ${RESOURCES})
89 SET(SOURCES ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES})
91 # main target
93 ADD_EXECUTABLE(${TARGET} ${SOURCES})
94 TARGET_LINK_LIBRARIES(${TARGET} ${LIBRARIES})
95 ADD_DEPENDENCIES(${TARGET} Version)
97 # installation
99 INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin)
100 INSTALL(FILES skype-call-recorder.desktop DESTINATION share/applications)
101 INSTALL(FILES icon.png DESTINATION share/icons/hicolor/128x128/apps
102         RENAME skype-call-recorder.png)