diff options
author | gregory guy <g-gregory@gmx.fr> | 2019-01-12 17:06:36 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-02-04 11:40:37 +0100 |
commit | 6d8d495faf0a8670d1657ec4dc0fb84f3e3d249a (patch) | |
tree | db20fa148a230b2da84767d8b5c60fcc6f9a97b4 | |
parent | 910d34b10fa4bfe2fae56e5d4481f45b063906a2 (diff) | |
download | libtdeldap-6d8d495faf0a8670d1657ec4dc0fb84f3e3d249a.tar.gz libtdeldap-6d8d495faf0a8670d1657ec4dc0fb84f3e3d249a.zip |
conversion to the cmake building system
Signed-off-by: gregory guy <g-gregory@gmx.fr>
-rw-r--r-- | CMakeLists.txt | 85 | ||||
-rw-r--r-- | ConfigureChecks.cmake | 64 | ||||
-rw-r--r-- | config.h.cmake | 23 | ||||
-rw-r--r-- | src/CMakeLists.txt | 43 | ||||
-rw-r--r-- | src/ldaplogindlg.cpp | 2 | ||||
-rw-r--r-- | src/libtdeldap.cpp | 17 |
6 files changed, 225 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5992725 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,85 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( libtdeldap ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) + + +#### include our cmake modules + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) + + +##### setup install paths + +include( TDESetupPaths ) +tde_setup_paths( ) + + +##### optional stuff + +option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) + + +##### user defined options + +set( KDE_CONFDIR "/etc/trinity" CACHE STRING "TDE Settings Directory" ) +set( KRB5_FILE "/etc/krb5.conf" CACHE STRING "Kerberos config file" ) +set( SYSTEM_CA_STORE_CERT_LOCATION "/usr/local/share/ca-certificates/" CACHE STRING "Location of ca-certificates" ) +set( CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_OPENLDAP_RELOAD_COMMAND "/etc/init.d/slapd force-reload" CACHE STRING "Cron command to update openLDAP" ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST -fpermissive ) + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( src ) +#tde_conditional_add_subdirectory( BUILD_DOC doc ) +#tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) + + +##### write configure files + +configure_file( config.h.cmake config.h @ONLY ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..e8b007b --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,64 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + + +# required stuff +find_package( TQt ) +find_package( TDE ) + +tde_setup_architecture_flags( ) + +include(TestBigEndian) +test_big_endian(WORDS_BIGENDIAN) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + if( NOT UNIX ) + tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" ) + endif( NOT UNIX ) + set( __KDE_HAVE_GCC_VISIBILITY 1 ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") +endif( WITH_GCC_VISIBILITY ) + + +##### check for ldap + +find_library( HAVE_LIBLDAP ldap ) +if( NOT HAVE_LIBLDAP ) + tde_message_fatal( "ldap is required, but was not found on your system" ) +endif( NOT HAVE_LIBLDAP ) + + +##### check for krb5 + +pkg_search_module( KRB5 krb5 ) +if( NOT KRB5_FOUND) + if( NOT DEFINED KRB5_CONFIG_EXECUTABLE ) + find_program( KRB5_CONFIG_EXECUTABLE NAMES krb5-config ) + if( NOT KRB5_CONFIG_EXECUTABLE ) + tde_message_fatal( "krb5 library is required but not found on your system" ) + endif( ) + endif( ) + + execute_process( + COMMAND ${KRB5_CONFIG_EXECUTABLE} --libs + OUTPUT_VARIABLE KRB5_LIBRARIES + ERROR_VARIABLE KRB5_LIBRARIES + ) + execute_process( + COMMAND ${KRB5_CONFIG_EXECUTABLE} --cflags + OUTPUT_VARIABLE KRB5_INCLUDE_DIRS + ERROR_VARIABLE KRB5_INCLUDE_DIRS + ) + if( NOT "${KRB5_LIBRARIES}" STREQUAL "" ) + set( KRB5_FOUND 1 ) + endif( ) +endif( ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..bcdb7e8 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,23 @@ +#define VERSION "@VERSION@" + +// Defined if you have fvisibility and fvisibility-inlines-hidden support. +#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ + +/* Define TDE Settings Directory */ +#cmakedefine KDE_CONFDIR "@KDE_CONFDIR@" + +/* Define Kerberos config file */ +#cmakedefine KRB5_FILE "@KRB5_FILE@" + +/* Define Location of ca-certificates */ +#cmakedefine SYSTEM_CA_STORE_CERT_LOCATION "@SYSTEM_CA_STORE_CERT_LOCATION@" + +/* Define Command to update ca-certificats */ +#cmakedefine SYSTEM_CA_STORE_REGENERATE_COMMAND "@SYSTEM_CA_STORE_REGENERATE_COMMAND@" + +/* Define Cron command to update openLDAP certificats */ +#cmakedefine CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_OPENLDAP_RELOAD_COMMAND "@CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_OPENLDAP_RELOAD_COMMAND@" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..a8db41b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,43 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR}/tde + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${KRB5_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### tdeldap (shared) + +tde_add_library( tdeldap SHARED AUTOMOC + + SOURCES + libtdeldap.cpp + ldaplogindlgbase.ui + ldaplogindlg.cpp + ldappasswddlg.cpp + LINK + tdeui-shared + tdecore-shared + tdeio-shared + tdesu + krb5 kadm5clnt kadm5srv hdb lber + ldap + + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### headers + +install( + FILES ldappasswddlg.h libtdeldap.h + DESTINATION ${INCLUDE_INSTALL_DIR} +) diff --git a/src/ldaplogindlg.cpp b/src/ldaplogindlg.cpp index 5a5acd1..458c0d9 100644 --- a/src/ldaplogindlg.cpp +++ b/src/ldaplogindlg.cpp @@ -43,4 +43,4 @@ LDAPLogin::~LDAPLogin(){ // } -// #include "ldaplogindlg.moc" +#include "ldaplogindlg.moc" diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp index f0e5389..236f307 100644 --- a/src/libtdeldap.cpp +++ b/src/libtdeldap.cpp @@ -88,13 +88,13 @@ extern "C" { #define LDAP_INSECURE_PORT 389 #define LDAP_SECURE_PORT 636 -// FIXME -// Connect this to CMake/Automake +#ifndef KDE_CONFDIR #define KDE_CONFDIR "/etc/trinity" +#endif -// FIXME -// This assumes Debian! +#ifndef KRB5_FILE #define KRB5_FILE "/etc/krb5.conf" +#endif //#define KRB5_ANK_RANDOM_PASSWORD_LENGTH 1024 #define KRB5_ANK_RANDOM_PASSWORD_LENGTH 512 @@ -120,14 +120,15 @@ extern "C" { #define CRON_UPDATE_NSS_FILE "/etc/cron.daily/upd-local-nss-db" #define CRON_UPDATE_NSS_COMMAND "/usr/sbin/nss_updatedb ldap" -// FIXME -// This assumes Debian! +#ifndef SYSTEM_CA_STORE_CERT_LOCATION #define SYSTEM_CA_STORE_CERT_LOCATION "/usr/local/share/ca-certificates/" +#endif + #define SYSTEM_CA_STORE_REGENERATE_COMMAND "update-ca-certificates" -// FIXME -// This assumes Debian! +#ifndef CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_OPENLDAP_RELOAD_COMMAND #define CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_OPENLDAP_RELOAD_COMMAND "/etc/init.d/slapd force-reload" +#endif int requested_ldap_version = LDAP_VERSION3; char* ldap_user_and_operational_attributes[2] = {"*", "+"}; |