aboutsummaryrefslogtreecommitdiff
path: root/kde-modules
diff options
context:
space:
mode:
Diffstat (limited to 'kde-modules')
-rw-r--r--kde-modules/KDECMakeSettings.cmake63
-rw-r--r--kde-modules/KDECompilerSettings.cmake3
-rw-r--r--kde-modules/KDEFrameworkCompilerSettings.cmake21
-rw-r--r--kde-modules/KDEInstallDirs.cmake28
4 files changed, 95 insertions, 20 deletions
diff --git a/kde-modules/KDECMakeSettings.cmake b/kde-modules/KDECMakeSettings.cmake
index 4ccbf82e..8e7ff359 100644
--- a/kde-modules/KDECMakeSettings.cmake
+++ b/kde-modules/KDECMakeSettings.cmake
@@ -41,6 +41,23 @@
#
# This section can be disabled by setting ``KDE_SKIP_BUILD_SETTINGS`` to TRUE
# before including this module.
+#
+# This section also provides an "uninstall" target that can be individually
+# disabled by setting ``KDE_SKIP_UNINSTALL_TARGET`` to TRUE before including
+# this module.
+#
+# By default on OS X, X11 and XCB related detections are disabled. However if
+# the need would arise to use these technologies, the detection can be enabled
+# by setting ``APPLE_FORCE_X11`` to ``ON``.
+#
+# A warning is printed for the developer to know that the detection is disabled on OS X.
+# This message can be turned off by setting ``APPLE_SUPPRESS_X11_WARNING`` to ``ON``.
+#
+# Since pre-1.0.0.
+#
+# - Uninstall target functionality since 1.7.0.
+# - ``APPLE_FORCE_X11`` option since 5.14.0 (detecting X11 was previously the default behavior)
+# - ``APPLE_SUPPRESS_X11_WARNING`` option since 5.14.0
#=============================================================================
# Copyright 2014 Alex Merry <alex.merry@kde.org>
@@ -78,21 +95,23 @@ if(NOT KDE_SKIP_RPATH_SETTINGS)
endif()
if (UNIX)
+ # for mac os: add install name dir in addition
+ # check: is the rpath stuff below really required on mac os? at least it seems so to use a stock qt from qt.io
if (APPLE)
set(CMAKE_INSTALL_NAME_DIR ${_abs_LIB_INSTALL_DIR})
- else ()
- # add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of
- # the standard system link directories - such as /usr/lib on UNIX)
- list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemLibDir)
- list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCxxLibDir)
- list(FIND CMAKE_C_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCLibDir)
- if("${_isSystemLibDir}" STREQUAL "-1" AND "${_isSystemCxxLibDir}" STREQUAL "-1" AND "${_isSystemCLibDir}" STREQUAL "-1")
- set(CMAKE_INSTALL_RPATH "${_abs_LIB_INSTALL_DIR}")
- endif()
-
- # Append directories in the linker search path (but outside the project)
- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
+
+ # add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of
+ # the standard system link directories - such as /usr/lib on UNIX)
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemLibDir)
+ list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCxxLibDir)
+ list(FIND CMAKE_C_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCLibDir)
+ if("${_isSystemLibDir}" STREQUAL "-1" AND "${_isSystemCxxLibDir}" STREQUAL "-1" AND "${_isSystemCLibDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${_abs_LIB_INSTALL_DIR}")
+ endif()
+
+ # Append directories in the linker search path (but outside the project)
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif (UNIX)
endif()
@@ -177,5 +196,25 @@ if(NOT KDE_SKIP_BUILD_SETTINGS)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
endif()
+ # Disable detection of X11 and related package on OS X because when using
+ # brew or macports, X11 can be installed and thus is detected.
+ option(APPLE_FORCE_X11 "Force enable X11 related detection on OS X" OFF)
+ option(APPLE_SUPPRESS_X11_WARNING "Suppress X11 and related technologies search disabling warning on OS X" OFF)
+
+ if(APPLE AND NOT APPLE_FORCE_X11)
+ if (NOT APPLE_SUPPRESS_X11_WARNING)
+ message(WARNING "Searching for X11 and related technologies is disabled on Apple systems. Set APPLE_FORCE_X11 to ON to change this behaviour. Set APPLE_SUPPRESS_X11_WARNING to ON to hide this warning.")
+ endif()
+
+ set(CMAKE_DISABLE_FIND_PACKAGE_X11 true)
+ set(CMAKE_DISABLE_FIND_PACKAGE_XCB true)
+ set(CMAKE_DISABLE_FIND_PACKAGE_Qt5X11Extras true)
+ endif()
+
+ option(KDE_SKIP_UNINSTALL_TARGET "Prevent an \"uninstall\" target from being generated." OFF)
+ if(NOT KDE_SKIP_UNINSTALL_TARGET)
+ include("${ECM_MODULE_DIR}/ECMUninstallTarget.cmake")
+ endif()
+
endif()
###################################################################
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index aa0249d9..73d77825 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -29,6 +29,8 @@
#
# Enables exceptions for C++ source files compiled for the
# CMakeLists.txt file in the current directory and all subdirectories.
+#
+# Since pre-1.0.0.
#=============================================================================
# Copyright 2014 Alex Merry <alex.merry@kde.org>
@@ -194,6 +196,7 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
endif()
# Default to hidden visibility for symbols
+set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
diff --git a/kde-modules/KDEFrameworkCompilerSettings.cmake b/kde-modules/KDEFrameworkCompilerSettings.cmake
index 3b77fc3c..e88c10d9 100644
--- a/kde-modules/KDEFrameworkCompilerSettings.cmake
+++ b/kde-modules/KDEFrameworkCompilerSettings.cmake
@@ -11,6 +11,8 @@
# For example, constructions like QString("foo") are prohibited, instead
# forcing the use of QLatin1String or QStringLiteral, and some
# Qt-defined keywords like signals and slots will not be defined.
+#
+# Since pre-1.0.0.
#=============================================================================
# Copyright 2013 Albert Astals Cid <aacid@kde.org>
@@ -38,11 +40,16 @@ add_definitions(-DQT_NO_CAST_TO_ASCII
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_USE_QSTRINGBUILDER
)
-if(NOT MSVC)
- # QT_STRICT_ITERATORS breaks MSVC: it tries to link to QTypedArrayData symbols
- # when using foreach. However these symbols don't actually exist.
- # Not having QT_STRICT_ITERATORS defined fixes this issue.
- # This is fixed by https://codereview.qt-project.org/#change,76311
- # TODO: set QT_STRICT_ITERATORS on all platforms once we depend on Qt 5.3
- add_definitions(-DQT_STRICT_ITERATORS)
+
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ add_definitions(-DQT_STRICT_ITERATORS)
+endif()
+
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ # -Wgnu-zero-variadic-macro-arguments is triggered by every qCDebug() call and therefore results
+ # in a lot of noise. This warning is only notifying us that clang is emulating the GCC behaviour
+ # instead of the exact standard wording so we can safely ignore it
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-gnu-zero-variadic-macro-arguments")
endif()
diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake
index 72a67641..b7cd34d8 100644
--- a/kde-modules/KDEInstallDirs.cmake
+++ b/kde-modules/KDEInstallDirs.cmake
@@ -132,7 +132,8 @@
# ``KDE_INSTALL_DIRS_NO_DEPRECATED`` is set to TRUE, only those variables
# defined by the ``GNUInstallDirs`` module (shipped with CMake) are defined.
# If ``KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES`` is set to TRUE, no variables with
-# a ``CMAKE_`` prefix will be defined by this module.
+# a ``CMAKE_`` prefix will be defined by this module (other than
+# CMAKE_INSTALL_DEFAULT_COMPONENT_NAME - see below).
#
# The ``KDE_INSTALL_<dir>`` variables (or their ``CMAKE_INSTALL_<dir>`` or
# deprecated counterparts) may be passed to the DESTINATION options of
@@ -161,6 +162,18 @@
#
# Additionally, ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` will be set to
# ``${PROJECT_NAME}`` to provide a sensible default for this CMake option.
+#
+# Note that mixing absolute and relative paths, particularly for ``BINDIR``,
+# ``LIBDIR`` and ``INCLUDEDIR``, can cause issues with exported targets. Given
+# that the default values for these are relative paths, relative paths should
+# be used on the command line when possible (eg: use
+# ``-DKDE_INSTALL_LIBDIR=lib64`` instead of
+# ``-DKDE_INSTALL_LIBDIR=/usr/lib/lib64`` to override the library directory).
+#
+# Since pre-1.0.0.
+#
+# NB: The variables starting ``KDE_INSTALL_`` are only available since 1.6.0.
+# The ``APPDIR`` install variable is available since 1.1.0.
#=============================================================================
# Copyright 2014-2015 Alex Merry <alex.merry@kde.org>
@@ -564,6 +577,19 @@ _define_relative(AUTOSTARTDIR CONFDIR "autostart"
"autostart files"
AUTOSTART_INSTALL_DIR)
+set(_mixed_core_path_styles FALSE)
+if (IS_ABSOLUTE "${KDE_INSTALL_BINDIR}")
+ if (NOT IS_ABSOLUTE "${KDE_INSTALL_LIBDIR}" OR NOT IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR}")
+ set(_mixed_core_path_styles )
+ endif()
+else()
+ if (IS_ABSOLUTE "${KDE_INSTALL_LIBDIR}" OR IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR}")
+ set(_mixed_core_path_styles TRUE)
+ endif()
+endif()
+if (_mixed_core_path_styles)
+ message(WARNING "KDE_INSTALL_BINDIR, KDE_INSTALL_LIBDIR and KDE_INSTALL_INCLUDEDIR should either all be absolute paths or all be relative paths.")
+endif()
# For more documentation see above.