summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt184
1 files changed, 81 insertions, 103 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 600430b..647af0e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,104 +1,82 @@
-project(kpilot)
-
-if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
- include(${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
-else(EXISTS ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
- message(FATAL_ERROR "CMakeOptions.txt not found! Run configure first.")
-endif(EXISTS ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
-
-# Search our own cmake modules path first
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
-
-# Need 2.4.3 for its KDE3 support
-# Need 2.4.4 for its fixed KDE3 support
-cmake_minimum_required(VERSION 2.8 )
-
-CONFIGURE_FILE(
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
-
-ADD_CUSTOM_TARGET(uninstall
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-
-# Disallow in-source build
-STRING(COMPARE EQUAL "${kpilot_SOURCE_DIR}" "${kpilot_BINARY_DIR}" insource)
-if(insource)
- MESSAGE(FATAL_ERROR
- "KPilot requires an out of source build. Please create a separate build
-directory and run 'cmake path_to_kpilot [options]' there."
- )
-endif(insource)
-
-find_package(Qt3) # find and setup Qt3 for this project
-
-if (NOT TQT_INCLUDE_DIR)
- MESSAGE(STATUS_ERROR "Qt3 package not found--assuming TQt4")
- SET(TQT_INCLUDE_DIR "/usr/include/qt4" CACHE PATH "" FORCE)
-endif (NOT TQT_INCLUDE_DIR)
-SET(QT_UIC_EXECUTABLE "/usr/bin/uic-tqt")
-SET(QT_MOC_EXECUTABLE "/usr/bin/tmoc")
-
-find_package(KDE3 REQUIRED) # find and setup KDE3 for this project
-find_package(Pilotlink REQUIRED)
-find_package(Mal) # see if mal is available, but it's not required
-
-add_definitions(
- ${QT_DEFINITIONS}
- ${KDE3_DEFINITIONS}
- -DTQT_THREAD_SUPPORT
-)
-
-STRING(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "debug" builddebug)
-if (NOT builddebug)
- add_definitions(-DNDEBUG)
-endif(NOT builddebug)
-
-
-# Get the trinity dir. This is a bit tricky, i'm not sure how well
-# this works on other systems.
-STRING(REPLACE "/lib" "" KDE3_DIR ${KDE3_LIB_DIR})
-
-# TODO: INSTALL PREFIX. RIGHT NOW EVERYTHING IS INSTALLED IN $TDEDIR
-if(NOT CMAKE_INSTALL_PREFIX)
- set(CMAKE_INSTALL_PREFIX ${KDE3_DIR})
-endif(NOT CMAKE_INSTALL_PREFIX)
-set(KDE3_KCFG_DIR ${CMAKE_INSTALL_PREFIX}/share/config.kcfg)
-set(KDE3_SERVICETYPES_DIR ${CMAKE_INSTALL_PREFIX}/share/servicetypes)
-set(KDE3_SERVICES_DIR ${CMAKE_INSTALL_PREFIX}/share/services)
-set(KDE3_XDG_APPS_DIR ${CMAKE_INSTALL_PREFIX}/share/applications/tde)
-set(KDE3_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
-set(KDE3_PLUGIN_INSTALL_DIR ${KDE3_LIB_INSTALL_DIR}/trinity)
-
-# tell cmake where to search for libraries:
-link_directories(${KDE3_LIB_DIR})
-
-# tell cmake where to search for Qt/KDE headers:
-include_directories(${PILOTLINK_INCLUDE_DIR} ${KDE3_INCLUDE_DIR} ${TQT_INCLUDE_DIR})
-
-# include custom macros
-INCLUDE(${CMAKE_SOURCE_DIR}/cmake/modules/KPilotCustom.cmake)
-
-# tell cmake to process CMakeLists.txt in that subdirectory
-add_subdirectory(lib)
-add_subdirectory(kpilot)
-add_subdirectory(conduits)
-
-
-STRING(COMPARE EQUAL "${ENABLE_TESTS}" "YES" buildtests)
-if (buildtests)
- MESSAGE(STATUS "BUILD: Test suite enabled.")
- enable_testing()
- add_subdirectory(tests)
-else (buildtests)
- MESSAGE(STATUS "BUILD: Test suite disabled.")
-endif(buildtests)
-
-if (builddebug)
- MESSAGE(STATUS "BUILD: Debug build selected.")
-else(builddebug)
- MESSAGE(STATUS "BUILD: Normal build selected.")
-endif(builddebug)
-
-MESSAGE(STATUS "BUILD: Install prefix set to ${CMAKE_INSTALL_PREFIX} .")
+#################################################
+#
+# (C) 2019 Slávek Banko
+# slavek.banko (AT) axis.cz
+#
+# Improvements and feedbacks are welcome
+#
+# This file is released under GPL >= 3
+#
+#################################################
+cmake_minimum_required( VERSION 2.8 )
+
+
+#### general package setup ######################
+
+project( kpilot )
+set( VERSION R14.1.0 )
+
+
+#### include essential cmake modules ############
+
+include( FindPkgConfig )
+include( CheckCSourceCompiles )
+include( CheckCXXSourceCompiles )
+include( CheckIncludeFile )
+include( CheckFunctionExists )
+include( CheckLibraryExists )
+include( CheckSymbolExists )
+
+
+#### 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} )
+
+
+##### configure checks ##########################
+
+include( ConfigureChecks.cmake )
+
+
+###### global compiler settings #################
+
+add_definitions( -DHAVE_CONFIG_H )
+
+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( lib )
+add_subdirectory( kpilot )
+add_subdirectory( conduits )
+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 )