160 lines
5.1 KiB
Diff
160 lines
5.1 KiB
Diff
From 9beb9f9aaa223864128fd8222f0f92ba8ae697b7 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@samba.org>
|
|
Date: Wed, 22 Nov 2017 15:27:44 +0100
|
|
Subject: [PATCH 1/2] cmake: Improve PAM_WRAPPER_LOACATION
|
|
|
|
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
Reviewed-by: Ralph Boehme <slow@samba.org>
|
|
---
|
|
src/CMakeLists.txt | 6 +-----
|
|
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 713625b..76a87d6 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -74,8 +74,4 @@ if (PYTHONLIBS_FOUND)
|
|
endif()
|
|
|
|
# This needs to be at the end
|
|
-if (POLICY CMP0026)
|
|
- cmake_policy(SET CMP0026 OLD)
|
|
-endif()
|
|
-get_target_property(PAM_WRAPPER_LOCATION pam_wrapper LOCATION)
|
|
-set(PAM_WRAPPER_LOCATION ${PAM_WRAPPER_LOCATION} PARENT_SCOPE)
|
|
+set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
|
|
--
|
|
2.16.1
|
|
|
|
|
|
From 84cd3dac56dbcb5815867b02876bb99759aecfd9 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@samba.org>
|
|
Date: Mon, 12 Feb 2018 12:01:22 +0100
|
|
Subject: [PATCH 2/2] cmake: Build python2 and python3 modules if possible
|
|
|
|
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
---
|
|
CMakeLists.txt | 5 -----
|
|
src/CMakeLists.txt | 4 +---
|
|
src/python/CMakeLists.txt | 15 ++-------------
|
|
src/python/python2/CMakeLists.txt | 23 +++++++++++++++++++++++
|
|
src/python/python3/CMakeLists.txt | 23 +++++++++++++++++++++++
|
|
5 files changed, 49 insertions(+), 21 deletions(-)
|
|
create mode 100644 src/python/python2/CMakeLists.txt
|
|
create mode 100644 src/python/python3/CMakeLists.txt
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f03a137..af00610 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -46,11 +46,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
|
|
set(CMAKE_THREAD_PREFER_PTHREADS ON)
|
|
find_package(Threads)
|
|
|
|
-find_package(PythonInterp)
|
|
-set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4 3.6)
|
|
-find_package(PythonLibs)
|
|
-find_package(PythonSiteLibs)
|
|
-
|
|
# config.h checks
|
|
include(ConfigureChecks.cmake)
|
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 76a87d6..e3a1efd 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -69,9 +69,7 @@ install(TARGETS pamtest
|
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
|
|
|
|
add_subdirectory(modules)
|
|
-if (PYTHONLIBS_FOUND)
|
|
- add_subdirectory(python)
|
|
-endif()
|
|
+add_subdirectory(python)
|
|
|
|
# This needs to be at the end
|
|
set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
|
|
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
|
|
index cbee2a6..3394a84 100644
|
|
--- a/src/python/CMakeLists.txt
|
|
+++ b/src/python/CMakeLists.txt
|
|
@@ -1,15 +1,4 @@
|
|
project(pypamtest C)
|
|
|
|
-include_directories(${CMAKE_BINARY_DIR})
|
|
-include_directories(${pam_wrapper-headers_DIR})
|
|
-include_directories(${PYTHON_INCLUDE_DIR})
|
|
-
|
|
-python_add_module(pypamtest pypamtest.c)
|
|
-target_link_libraries(pypamtest pamtest ${PYTHON_LIBRARY})
|
|
-
|
|
-install(
|
|
- TARGETS
|
|
- pypamtest
|
|
- DESTINATION
|
|
- ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}
|
|
-)
|
|
+add_subdirectory(python2)
|
|
+add_subdirectory(python3)
|
|
diff --git a/src/python/python2/CMakeLists.txt b/src/python/python2/CMakeLists.txt
|
|
new file mode 100644
|
|
index 0000000..c258d9e
|
|
--- /dev/null
|
|
+++ b/src/python/python2/CMakeLists.txt
|
|
@@ -0,0 +1,23 @@
|
|
+project(python2-pamtest C)
|
|
+
|
|
+unset(PYTHON_EXECUTABLE CACHE)
|
|
+
|
|
+set(Python_ADDITIONAL_VERSIONS 2.7 2.6)
|
|
+find_package(PythonLibs)
|
|
+find_package(PythonInterp)
|
|
+find_package(PythonSiteLibs)
|
|
+
|
|
+if (PYTHONLIBS_FOUND)
|
|
+ include_directories(${CMAKE_BINARY_DIR})
|
|
+ include_directories(${pam_wrapper-headers_DIR})
|
|
+ include_directories(${PYTHON_INCLUDE_DIR})
|
|
+
|
|
+ python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
|
|
+ target_link_libraries(python2-pamtest pamtest ${PYTHON_LIBRARY})
|
|
+ set_target_properties(python2-pamtest PROPERTIES OUTPUT_NAME "pypamtest")
|
|
+
|
|
+ install(TARGETS
|
|
+ python2-pamtest
|
|
+ DESTINATION
|
|
+ ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
|
|
+endif()
|
|
diff --git a/src/python/python3/CMakeLists.txt b/src/python/python3/CMakeLists.txt
|
|
new file mode 100644
|
|
index 0000000..19a5459
|
|
--- /dev/null
|
|
+++ b/src/python/python3/CMakeLists.txt
|
|
@@ -0,0 +1,23 @@
|
|
+project(python3-pamtest C)
|
|
+
|
|
+unset(PYTHON_EXECUTABLE CACHE)
|
|
+
|
|
+set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6)
|
|
+find_package(PythonLibs)
|
|
+find_package(PythonInterp)
|
|
+find_package(PythonSiteLibs)
|
|
+
|
|
+if (PYTHONLIBS_FOUND)
|
|
+ include_directories(${CMAKE_BINARY_DIR})
|
|
+ include_directories(${pam_wrapper-headers_DIR})
|
|
+ include_directories(${PYTHON_INCLUDE_DIR})
|
|
+
|
|
+ python_add_module(python3-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
|
|
+ target_link_libraries(python3-pamtest pamtest ${PYTHON_LIBRARY})
|
|
+ set_target_properties(python3-pamtest PROPERTIES OUTPUT_NAME "pypamtest")
|
|
+
|
|
+ install(TARGETS
|
|
+ python3-pamtest
|
|
+ DESTINATION
|
|
+ ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
|
|
+endif()
|
|
--
|
|
2.16.1
|
|
|