aboutsummaryrefslogtreecommitdiffstats
path: root/pam_agl/CMakeLists.txt
blob: 17c85bea4adf0148158ea800ca0bfa707deb71cc (plain)
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
###########################################################################
# Copyright 2015, 2016, 2017 IoT.bzh
#
# author: Loïc Collignon <loic.collignon@iot.bzh>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###########################################################################

cmake_minimum_required(VERSION 3.3)
project(pam_agl)

include(FindPkgConfig)

# Require PAM but there is no find_package
set(PAM_INCLUDE_DIR "/usr/include/")
set(PAM_LIBRARY "/lib64/libpam.so.0")
include_directories(${PAM_INCLUDE_DIR})

# Find json-c
pkg_check_modules(${JSON_C} REQUIRED json-c)
include_directories(${${JSON_C}_INCLUDE_DIRS})
add_compile_options(${${JSON_C}_CFLAGS})

# Add the target
add_library(pam_agl SHARED pam_agl.c)
target_link_libraries(pam_agl ${PAM_LIBRARY} ${${JSON_C}_LIBRARIES})
#list (APPEND link_libraries ${${JSON_C}_LDFLAGS})
set_property(TARGET pam_agl PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET pam_agl PROPERTY PREFIX "")

if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
	get_filename_component(CMAKE_INSTALL_LIBDIR ${PAM_LIBRARY} DIRECTORY)
endif()

install(TARGETS pam_agl
	LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/security/")