This repository was archived by the owner on May 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
55 lines (41 loc) · 2.27 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
55
# This file is part of graphene-desktop, the desktop environment of VeltOS.
# Copyright (C) 2016 Velt Technologies, Aidan Shafran <[email protected]>
# This file is licensed under the WTFPL.
cmake_minimum_required(VERSION 3.4)
project(graphene-desktop)
set(GRAPHENE_VERSION 0.3)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_C_FLAGS "-Wall -Wextra -DUNUSED=G_GNUC_UNUSED")
set(CMAKE_C_FLAGS_DEBUG "-g -DGRAPHENE_DEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3")
add_definitions(-DGRAPHENE_VERSION_STR=\"${GRAPHENE_VERSION}\")
# Assume the user wants to install Graphene to /usr unless otherwise specified
# with the -DCMAKE_INSTALL_PREFIX=<path> flag to cmake. http://stackoverflow.com/a/16076855
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "default install path" FORCE)
endif()
# Config
include_directories(${PROJECT_BINARY_DIR})
# Acquire libraries needed for all targets
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.10)
link_libraries(${GLIB2_LIBRARIES})
include_directories(${GLIB2_INCLUDE_DIRS})
# Setup targets
add_subdirectory(src)
# Install
install(FILES graphene.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xsessions)
install(DIRECTORY schemas/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas)
if(NOT DONT_COMPILE_SCHEMAS)
install(CODE "execute_process(COMMAND make compile-schemas)") # There is probably a better way to do this...
endif()
# Convenience target to compile glib schemas (usually post-install and post-uninstall)
add_custom_target(compile-schemas COMMAND glib-compile-schemas \"${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\" )
# Force install - kills running process, runs install
add_custom_target(finstall COMMAND killall graphene-desktop nautilus-desktop gnome-settings-daemon\; make install )
# Uninstall target (only works after installing with install_manifest.txt)
# Removes all files listed in install_manifest.txt, and then removes install_manifest.txt
# If install_manifest.txt is not available, an error message is printed.
add_custom_target(uninstall COMMAND { [ -f install_manifest.txt ] && xargs --verbose -d '\\n' rm < install_manifest.txt && rm install_manifest.txt\; } || echo ' *** ERROR: Missing install_manifest.txt: you must install first!' )