mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
cmake: new baseline kde4_optional_add_subdirectory() macro replacing macro_optional_add_subdirectory()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
08345f1315
commit
b40ed43aa4
7 changed files with 22 additions and 71 deletions
|
@ -31,7 +31,6 @@ set(LIBRARY_TYPE SHARED)
|
|||
|
||||
find_package(KDE4Internal REQUIRED)
|
||||
include(KDE4Defaults)
|
||||
include(MacroLibrary)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
if(UNIX AND Q_WS_X11)
|
||||
|
|
|
@ -69,8 +69,6 @@ set(cmakeFiles
|
|||
kde4_exec.sh.in
|
||||
KDE4Defaults.cmake
|
||||
KDE4Macros.cmake
|
||||
MacroLibrary.cmake
|
||||
MacroOptionalAddSubdirectory.cmake
|
||||
MacroOptionalFindPackage.cmake
|
||||
)
|
||||
|
||||
|
|
|
@ -136,10 +136,9 @@ if(NOT Katie_FOUND)
|
|||
endif()
|
||||
|
||||
# now we are sure we have everything we need
|
||||
include(MacroLibrary)
|
||||
include(MacroOptionalFindPackage)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCXXSourceCompiles)
|
||||
# used to be included in MacroLogFeature which was included by MacroLibrary
|
||||
# TODO: move to main CMakeLists.txt files at the same time CMP0000 is dealt with
|
||||
include(FeatureSummary)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
# KDE4_INSTALL_AUTH_HELPER_FILES
|
||||
# KDE4_ADD_DBUS_SERVICE
|
||||
# KDE4_BOOL_TO_01
|
||||
# KDE4_OPTIONAL_ADD_SUBDIRECTORY
|
||||
|
||||
# Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
|
||||
|
@ -54,7 +55,7 @@ macro(_KDE4_ADD_ICON_INSTALL_RULE _install_PATH _group _orig_NAME _install_NAME
|
|||
endif()
|
||||
endmacro(_KDE4_ADD_ICON_INSTALL_RULE)
|
||||
|
||||
# KDE4_INSTALL_ICONS ( path theme)
|
||||
# KDE4_INSTALL_ICONS(PATH THEME)
|
||||
# Installs all png and svgz files in the current directory to the icon
|
||||
# directory given in path, in the subdirectory for the given icon theme.
|
||||
macro(KDE4_INSTALL_ICONS _defaultpath )
|
||||
|
@ -116,7 +117,7 @@ macro(KDE4_INSTALL_ICONS _defaultpath )
|
|||
endforeach()
|
||||
endmacro(KDE4_INSTALL_ICONS)
|
||||
|
||||
# KDE4_ADD_KCFG_FILES (SRCS_VAR file1.kcfgc ... fileN.kcfgc)
|
||||
# KDE4_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc)
|
||||
# Use this to add KDE config compiler files to your application/library.
|
||||
macro(KDE4_ADD_KCFG_FILES _sources )
|
||||
foreach(_current_FILE ${ARGN})
|
||||
|
@ -154,7 +155,7 @@ macro(KDE4_ADD_KCFG_FILES _sources )
|
|||
endforeach (_current_FILE)
|
||||
endmacro(KDE4_ADD_KCFG_FILES)
|
||||
|
||||
# KDE4_ADD_PLUGIN ( name [WITH_PREFIX] file1 ... fileN )
|
||||
# KDE4_ADD_PLUGIN(NAME [WITH_PREFIX] FILE1 ... FILEN)
|
||||
# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
|
||||
# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib",
|
||||
# otherwise it won't.
|
||||
|
@ -177,7 +178,7 @@ macro(KDE4_ADD_PLUGIN _target_NAME)
|
|||
endif()
|
||||
endmacro(KDE4_ADD_PLUGIN)
|
||||
|
||||
# KDE4_ADD_TEST (testname file1 ... fileN)
|
||||
# KDE4_ADD_TEST(TESTNAME FILE1 ... FILEN)
|
||||
# add a unit test, which is executed when running make test. The targets
|
||||
# are build and executed only if the ENABLE_TESTING option is enabled.
|
||||
# KDESRCDIR is set to the source directory of the test, this can be used
|
||||
|
@ -190,7 +191,7 @@ macro(KDE4_ADD_TEST _targetName)
|
|||
)
|
||||
endmacro(KDE4_ADD_TEST)
|
||||
|
||||
# KDE4_ADD_MANUAL_TEST (testname file1 ... fileN)
|
||||
# KDE4_ADD_MANUAL_TEST(TESTNAME FILE1 ... FILEN)
|
||||
# same as KDE_ADD_TEST() except that the test is not run on `make test`
|
||||
macro(KDE4_ADD_MANUAL_TEST _targetName)
|
||||
add_executable(${_targetName} ${ARGN})
|
||||
|
@ -206,7 +207,7 @@ macro(KDE4_ADD_MANUAL_TEST _targetName)
|
|||
)
|
||||
endmacro(KDE4_ADD_MANUAL_TEST)
|
||||
|
||||
# KDE4_ADD_WIDGET (SRCS_VAR file1.widgets ... fileN.widgets)
|
||||
# KDE4_ADD_WIDGET(SRCS_VAR FILE1.widgets ... FILEN.widgets)
|
||||
# Use this to add widget description files for the makekdewidgets code
|
||||
# generator for Qt Designer plugins.
|
||||
macro(KDE4_ADD_WIDGET _output _sources)
|
||||
|
@ -232,7 +233,7 @@ macro(KDE4_ADD_WIDGET _output _sources)
|
|||
endforeach(_current_FILE)
|
||||
endmacro(KDE4_ADD_WIDGET)
|
||||
|
||||
# KDE4_INSTALL_AUTH_HELPER_FILES ( HELPER_TARGET HELPER_ID HELPER_USER )
|
||||
# KDE4_INSTALL_AUTH_HELPER_FILES(HELPER_TARGET HELPER_ID HELPER_USER)
|
||||
# This macro adds the needed files for an helper executable meant to be used
|
||||
# by applications using KAuth. It accepts the helper target, the helper ID
|
||||
# (the D-Bus name) and the user under which the helper will run on.
|
||||
|
@ -265,9 +266,8 @@ function(KDE4_INSTALL_AUTH_HELPER_FILES HELPER_TARGET HELPER_ID HELPER_USER)
|
|||
)
|
||||
endfunction(KDE4_INSTALL_AUTH_HELPER_FILES)
|
||||
|
||||
# KDE4_ADD_DBUS_SERVICE (file1 ... fileN)
|
||||
# Use this to add D-Bus service activation file(s). The input file(s) must
|
||||
# be ".service.in" suffixed
|
||||
# KDE4_ADD_DBUS_SERVICE(FILE1.service.in ... FILEN.service.in)
|
||||
# Use this to add D-Bus service activation file(s)
|
||||
macro(KDE4_ADD_DBUS_SERVICE _sources)
|
||||
foreach(_current_FILE ${_sources})
|
||||
get_filename_component(_input ${_current_FILE} ABSOLUTE)
|
||||
|
@ -294,3 +294,14 @@ macro(KDE4_BOOL_TO_01 _var _result)
|
|||
set(${_result} 0)
|
||||
endif()
|
||||
endmacro(KDE4_BOOL_TO_01)
|
||||
|
||||
# KDE4_OPTIONAL_ADD_SUBDIRECTORY(DIR)
|
||||
# If you use KDE4_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY()
|
||||
# an option to skip the subdirectory will be added. Skipping the directory
|
||||
# will be possbile via: cmake -DBUILD_<dir>=TRUE <srcdir>
|
||||
macro(KDE4_OPTIONAL_ADD_SUBDIRECTORY _dir)
|
||||
option(BUILD_${_dir} "Build directory ${_dir}" TRUE)
|
||||
if(BUILD_${_dir})
|
||||
add_subdirectory(${_dir})
|
||||
endif()
|
||||
endmacro(KDE4_OPTIONAL_ADD_SUBDIRECTORY)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# - include MacroLibrary offers a collection of macros which extend the built-in cmake commands
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
INCLUDE(MacroOptionalFindPackage)
|
||||
INCLUDE(MacroOptionalAddSubdirectory)
|
|
@ -1,46 +0,0 @@
|
|||
# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
|
||||
# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
|
||||
# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
|
||||
# this will have two effects
|
||||
# 1 - CMake will not complain if the directory doesn't exist
|
||||
# This makes sense if you want to distribute just one of the subdirs
|
||||
# in a source package, e.g. just one of the subdirs in kdeextragear.
|
||||
# 2 - If the directory exists, it will offer an option to skip the
|
||||
# subdirectory.
|
||||
# This is useful if you want to compile only a subset of all
|
||||
# directories.
|
||||
#
|
||||
# If the CMake variable DISABLE_ALL_OPTIONAL_SUBDIRECTORIES is set to TRUE
|
||||
# for the first CMake run on the project, all optional subdirectories will be disabled
|
||||
# by default (but can of course be enabled via the respective options).
|
||||
# E.g. the following will disable all optional subdirectories except the one named "kcalc":
|
||||
# $ cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_kcalc=TRUE <srcdir>
|
||||
|
||||
# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
|
||||
GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
|
||||
IF(EXISTS ${_fullPath}/CMakeLists.txt AND EXISTS ${_fullPath}/.skipdir)
|
||||
FILE(READ ${_fullPath}/.skipdir _message)
|
||||
MESSAGE(WARNING "${_message}")
|
||||
ELSEIF(EXISTS ${_fullPath}/CMakeLists.txt)
|
||||
IF(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES)
|
||||
SET(_DEFAULT_OPTION_VALUE FALSE)
|
||||
ELSE()
|
||||
SET(_DEFAULT_OPTION_VALUE TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(DISABLE_ALL_OPTIONAL_SUBDIRS AND NOT DEFINED BUILD_${_dir})
|
||||
SET(_DEFAULT_OPTION_VALUE FALSE)
|
||||
ENDIF()
|
||||
|
||||
OPTION(BUILD_${_dir} "Build directory ${_dir}" ${_DEFAULT_OPTION_VALUE})
|
||||
IF(BUILD_${_dir})
|
||||
ADD_SUBDIRECTORY(${_dir})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)
|
|
@ -56,7 +56,6 @@
|
|||
*
|
||||
* find_package(KDE4 REQUIRED)
|
||||
* include (KDE4Defaults)
|
||||
* include(MacroOptionalAddSubdirectory)
|
||||
*
|
||||
* set(filetypethumbnail_SRCS filetypethumbnail.cpp)
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue