summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 33 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14fab01..da56d2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,12 +1,41 @@
project(ULOCK C)
cmake_minimum_required(VERSION 2.8)
+set(CMAKE_MODULE_PATH ${ULOCK_SOURCE_DIR})
+
+find_package(Gettext REQUIRED)
+
+find_package(PAM REQUIRED)
+
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-x11-3.0)
+pkg_check_modules(GDK3 REQUIRED gdk-x11-3.0)
+pkg_check_modules(X11 REQUIRED x11)
+
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+find_package(Threads)
+if(NOT CMAKE_USE_PTHREADS_INIT)
+ MESSAGE(FATAL_ERROR "No pthread support found.")
+endif(NOT CMAKE_USE_PTHREADS_INIT)
+
+
+set(CONFIG_DIR "/etc" CACHE STRING "Path to install ulock's configuration file to")
+set(DATA_DIR "share/ulock" CACHE STRING "Path to install ulock's data files to")
-include_directories(${GTK3_INCLUDE_DIRS})
+
+include_directories(${ULOCK_BINARY_DIR} ${GTK3_INCLUDE_DIRS} ${GDK3_INCLUDE_DIRS} ${X11_INCLUDE_DIRS} ${PAM_INCLUDE_DIR})
+
+configure_file(${ULOCK_SOURCE_DIR}/config.h.in ${ULOCK_BINARY_DIR}/config.h)
add_executable(ulock ulock.c)
-set_property(TARGET ulock PROPERTY COMPILE_FLAGS "-Wall ${GTK3_CFLAGS_OTHER}")
-set_property(TARGET ulock PROPERTY LINK_FLAGS "${GTK3_LDFLAGS_OTHER}")
-target_link_libraries(ulock ${GTK3_LIBRARIES})
+set_property(TARGET ulock PROPERTY COMPILE_FLAGS "-Wall -pthread ${GTK3_CFLAGS_OTHER} ${GDK3_CFLAGS_OTHER} ${X11_CFLAGS_OTHER}")
+set_property(TARGET ulock PROPERTY LINK_FLAGS "-pthread ${GTK3_LDFLAGS_OTHER} ${GDK3_LDFLAGS_OTHER} ${X11_LDFLAGS_OTHER}")
+target_link_libraries(ulock ${GTK3_LIBRARIES} ${GDK3_LIBRARIES} ${X11_LIBRARIES} ${PAM_LIBRARY})
+
+GETTEXT_PROCESS_PO_FILES(de ALL PO_FILES po/de.po)
+
+install(TARGETS ulock RUNTIME DESTINATION bin)
+install(DIRECTORY data/ DESTINATION ${DATA_DIR})
+install(FILES etc/ulock.conf DESTINATION ${CONFIG_DIR})
+
+install(FILES ${ULOCK_BINARY_DIR}/de.gmo DESTINATION share/locale/de/LC_MESSAGES RENAME ulock.mo)