From 90487b6cffc8b8404dd06d280dbdfa3264644823 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Sat, 12 Jan 2019 17:06:36 +0100 Subject: conversion to the cmake building system Signed-off-by: gregory guy (cherry picked from commit 6d8d495faf0a8670d1657ec4dc0fb84f3e3d249a) --- CMakeLists.txt | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 37 +++++++++++++++++++++++ config.h.cmake | 17 +++++++++++ src/CMakeLists.txt | 43 ++++++++++++++++++++++++++ src/ldaplogindlg.cpp | 2 +- src/libtdeldap.cpp | 12 ++++---- 6 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..96b0809 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,84 @@ +############################################ +# # +# 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.0.6 ) + + +#### 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( 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 -UQT_NO_ASCII_CAST ) + +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..5ecc67e --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,37 @@ +########################################### +# # +# 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 ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..32aed67 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,17 @@ +#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 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..09658b9 --- /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 + 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 1e2678c..efd852e 100644 --- a/src/libtdeldap.cpp +++ b/src/libtdeldap.cpp @@ -50,13 +50,13 @@ #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 NSSWITCH_FILE "/etc/nsswitch.conf" @@ -74,9 +74,9 @@ #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 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] = {"*", "+"}; -- cgit v1.2.1