-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (44 loc) · 2.3 KB
/
CMakeLists.txt
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
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
PROJECT("ClamGTK")
IF(UNIX)
# VARIABLE #
SET(CMAKE_INSTALL_PREFIX "/usr")
SET(DIR_APPLICATIONS "share/applications")
SET(DIR_DATA "share/ClamGTK")
SET(DIR_BIN "bin")
SET(DATA_CLAMGTK "DATA")
# DEB #
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
FILE(READ "resource.h" ver)
STRING(REGEX MATCH "APP_VERSION \"([0-9]+\\.[0-9]+)\"" _ ${ver})
SET(CPACK_PACKAGE_VERSION ${CMAKE_MATCH_1})
SET(CPACK_PACKAGE_CONTACT "[email protected]")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Interface Graphique pour ClamAV")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bubi GAUDRIOLES")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-3-0, zenity")
INCLUDE(CPack)
# BUILD #
SET(CMAKE_C_FLAGS "-Wall -Werror -pedantic-errors -O3")
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(GTK3 REQUIRED gtk+-3.0)
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
ADD_EXECUTABLE(${PROJECT_NAME} main.c gui.c fonction.c stack.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK3_LIBRARIES})
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/PKGBUILD_LINUX ${CMAKE_CURRENT_BINARY_DIR}/PKGBUILD)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/${DATA_CLAMGTK} ${CMAKE_CURRENT_BINARY_DIR}/${DATA_CLAMGTK})
# INSTALL #
INSTALL(FILES "DATA/clamav.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/file.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/search.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/folder.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/update.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/valid.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/del.png" DESTINATION ${DIR_DATA})
INSTALL(FILES "DATA/clamgtk.desktop" DESTINATION ${DIR_APPLICATIONS})
INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/${PROJECT_NAME} DESTINATION ${DIR_BIN} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ELSE()
MESSAGE(FATAL_ERROR "Platforme non pris en charge\n")
ENDIF()