From 2ba6f30ca09e805d90c164fba776248373aef621 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Tue, 16 Oct 2012 10:46:45 -0400 Subject: cmake tidy-up --- CMakeLists.txt | 6 +++--- cmake/FindPAM.cmake | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cmake/FindPAM.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ad641cf..70c4c24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) find_package(Glib) find_package(GIO) find_package(Mhash) +find_package(PAM) pkg_check_modules(LIBUSER REQUIRED libuser) add_definitions(${LIBUSER_CFLAGS}) -link_libraries(${LIBUSER_LDFLAGS}) -link_libraries(-lpam) +#add_definitions(${PAM_INCLUDE_DIR}) include_directories(${GLIB_PKG_INCLUDE_DIRS}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -funsigned-char -Wall") @@ -32,7 +32,7 @@ add_executable(instr-daemon instr-daemon.c ) add_executable(instr-client instr-client.c) -target_link_libraries(instr-daemon gio-2.0 gobject-2.0 glib-2.0 mhash m) +target_link_libraries(instr-daemon gio-2.0 gobject-2.0 glib-2.0 mhash m pam user) target_link_libraries(instr-client gio-2.0 gobject-2.0 glib-2.0) INSTALL(TARGETS instr-daemon instr-client diff --git a/cmake/FindPAM.cmake b/cmake/FindPAM.cmake new file mode 100644 index 0000000..1ada899 --- /dev/null +++ b/cmake/FindPAM.cmake @@ -0,0 +1,20 @@ +find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h security/pam_misc.h) +find_library(PAM_LIBRARY pam) + +if (PAM_INCLUDE_DIR AND PAM_LIBRARY) + set(PAM_FOUND TRUE) +endif (PAM_INCLUDE_DIR AND PAM_LIBRARY) + +if (PAM_INCLUDE_DIR) + message(STATUS "Found PAM includes ${PAM_INCLUDE_DIR}") +else (PAM_INCLUDE_DIR) + message(FATAL_ERROR "PAM includes were not found") +endif (PAM_INCLUDE_DIR) + +if (PAM_LIBRARY) + message(STATUS "Found PAM library ${PAM_LIBRARY}") +else (PAM_LIBRARY) + message(FATAL_ERROR "PAM library was not found") +endif (PAM_LIBRARY) + +mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY) -- cgit