| 1 | # ########## Project setup ########## |
|---|
| 2 | PROJECT(pam_escalate) |
|---|
| 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) |
|---|
| 4 | |
|---|
| 5 | # ######### General setup ########## |
|---|
| 6 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) |
|---|
| 7 | |
|---|
| 8 | #Debugging |
|---|
| 9 | SET(CMAKE_VERBOSE_MAKEFILE off) |
|---|
| 10 | |
|---|
| 11 | # Flags |
|---|
| 12 | SET(CMAKE_C_FLAGS "-O2 -Wall -Wextra") |
|---|
| 13 | |
|---|
| 14 | # ########## pam_escalate library ########## |
|---|
| 15 | # Sources: |
|---|
| 16 | SET(SRCS pam_escalate.c ) |
|---|
| 17 | |
|---|
| 18 | # Headers: |
|---|
| 19 | SET(HDRS) |
|---|
| 20 | |
|---|
| 21 | # Includes: |
|---|
| 22 | if(EXISTS /usr/include/security/) |
|---|
| 23 | INCLUDE_DIRECTORIES(/usr/include/security/) |
|---|
| 24 | endif(EXISTS /usr/include/security/) |
|---|
| 25 | if(EXISTS /usr/include/pam/) |
|---|
| 26 | INCLUDE_DIRECTORIES(/usr/include/pam/) |
|---|
| 27 | endif(EXISTS /usr/include/pam/) |
|---|
| 28 | |
|---|
| 29 | # Libraries: |
|---|
| 30 | |
|---|
| 31 | # Target: |
|---|
| 32 | ADD_LIBRARY(pam_escalate MODULE ${SRCS} ${HDRS}) |
|---|
| 33 | target_link_libraries(pam_escalate pam pam_misc) |
|---|
| 34 | set_target_properties(pam_escalate PROPERTIES PREFIX "") |
|---|
| 35 | |
|---|
| 36 | # Install: |
|---|
| 37 | if(EXISTS /lib64/security/) |
|---|
| 38 | set(PAM_MODULES_LOCATION /lib64/security/) |
|---|
| 39 | elseif(EXISTS /lib/security/) |
|---|
| 40 | set(PAM_MODULES_LOCATION /lib/security/) |
|---|
| 41 | elseif(EXISTS /usr/lib/security/) |
|---|
| 42 | set(PAM_MODULES_LOCATION /usr/lib/security/) |
|---|
| 43 | elseif(EXISTS /usr/lib64/security/) |
|---|
| 44 | set(PAM_MODULES_LOCATION /usr/lib64/security/) |
|---|
| 45 | elseif(EXISTS /lib64/pam/) |
|---|
| 46 | set(PAM_MODULES_LOCATION /lib64/pam/) |
|---|
| 47 | elseif(EXISTS /lib/pam/) |
|---|
| 48 | set(PAM_MODULES_LOCATION /lib/pam/) |
|---|
| 49 | elseif(EXISTS /usr/lib64/pam/) |
|---|
| 50 | set(PAM_MODULES_LOCATION /usr/lib64/pam/) |
|---|
| 51 | elseif(EXISTS /usr/lib/pam/) |
|---|
| 52 | set(PAM_MODULES_LOCATION /usr/lib/pam/) |
|---|
| 53 | else(EXISTS /lib64/security/) |
|---|
| 54 | message(FATAL_ERROR "Cannot find the location of the pam_modules") |
|---|
| 55 | endif(EXISTS /lib64/security/) |
|---|
| 56 | find_path(PAM_MODULES_LOCATION pam_deny.so /lib64/security /lib/security /usr/lib64/security /usr/lib/security /lib64/pam /lib/pam /usr/lib64/pam /usr/lib/pam) |
|---|
| 57 | INSTALL(TARGETS pam_escalate DESTINATION ${PAM_MODULES_LOCATION}) |
|---|