diff options
author | Alex Merry <alex.merry@kde.org> | 2015-11-15 15:09:48 +0000 |
---|---|---|
committer | Alex Merry <alex.merry@kde.org> | 2015-11-22 10:39:45 +0000 |
commit | c941061aa989bba945e296aad47df22f9c8ddd5f (patch) | |
tree | 02ce7b041d556579bd2c8c3c224776553c8cc5bd | |
parent | 8f0cbc9f8a8e3b60df6755da1d7d5369ef37b8f2 (diff) | |
download | extra-cmake-modules-c941061aa989bba945e296aad47df22f9c8ddd5f.tar.gz extra-cmake-modules-c941061aa989bba945e296aad47df22f9c8ddd5f.tar.bz2 |
Overhaul the ECM build system.
It should now be easier to read, and more featureful. Among other
tweaks, we now print a summary of dependencies and build options, and
the documentation is generated with more sensible breadcrumbs and
builds properly with Sphinx 1.3.
REVIEW: 126075
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 160 | ||||
-rw-r--r-- | ECMConfig.cmake.in | 7 | ||||
-rw-r--r-- | cmake/FindQCollectionGenerator.cmake | 94 | ||||
-rw-r--r-- | cmake/FindSphinx.cmake | 91 | ||||
-rw-r--r-- | docs/CMakeLists.txt | 107 | ||||
-rw-r--r-- | docs/sphinx/conf.py.in | 18 | ||||
-rw-r--r-- | docs/sphinx/ecm.css.in (renamed from docs/sphinx/static/ecm.css) | 2 | ||||
-rw-r--r-- | docs/sphinx/ext/ecm.py (renamed from docs/sphinx/ecm.py) | 0 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 35 | ||||
-rw-r--r-- | tests/ECMGenerateHeadersTest/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/ECMGeneratePkgConfigFile/CMakeLists.txt | 2 |
12 files changed, 417 insertions, 102 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build diff --git a/CMakeLists.txt b/CMakeLists.txt index c1abd6c7..ef38b2fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,99 @@ +#============================================================================= +# Copyright 2006-2013 Alex Neundorf <neundorf@kde.org> +# Copyright 2014-2015 Alex Merry <alex.merry@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file COPYING-CMAKE-SCRIPTS for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -project(extra-cmake-modules NONE) +# +# Preliminary setup +# + +set(VERSION "5.16.0") # handled by release scripts + +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) + project(ECM + VERSION "${VERSION}" + LANGUAGES NONE + ) +else() + project(ECM NONE) + include("${CMAKE_SOURCE_DIR}/modules/ECMSetupVersion.cmake") + ecm_setup_version( + "${VERSION}" + VARIABLE_PREFIX ECM + ) +endif() + + +# +# Includes +# + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +include(FeatureSummary) + -set(ECM_MAJOR_VERSION 5) -set(ECM_MINOR_VERSION 16) -set(ECM_PATCH_VERSION 0) +# +# Installation paths +# -set(ECM_VERSION ${ECM_MAJOR_VERSION}.${ECM_MINOR_VERSION}.${ECM_PATCH_VERSION}) +set(SHARE_INSTALL_DIR share + CACHE + PATH + "read-only architecture-independent data" +) + +set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/cmake/) + +set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/find-modules/) +set(KDE_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/kde-modules/) +set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/modules/) +set(TOOLCHAIN_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/toolchain/) + +set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/ECM + CACHE + PATH + "HTML and QtHelp documentation" +) +set(MAN_INSTALL_DIR ${SHARE_INSTALL_DIR}/man + CACHE + PATH + "man pages" +) + + +# +# Documentation +# + +add_subdirectory(docs) + + +# +# Tests +# option(BUILD_TESTING "Build automated tests." ON) +add_feature_info(BUILD_TESTING BUILD_TESTING "Build automated tests.") if(BUILD_TESTING) enable_testing() add_subdirectory(tests) endif() -set(SHARE_INSTALL_DIR share CACHE PATH "read-only architecture-independent data") -set(TOOLCHAIN_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/toolchain/) -set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/modules/) -set(KDE_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/kde-modules/) -set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/find-modules/) -set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/cmake/) -set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/ECM) -set(MAN_INSTALL_DIR ${SHARE_INSTALL_DIR}/man) -add_subdirectory(docs) +# +# Install modules +# file(GLOB installModuleFiles ${CMAKE_SOURCE_DIR}/modules/*[^~]) install(FILES ${installModuleFiles} DESTINATION ${MODULES_INSTALL_DIR}) @@ -38,28 +108,58 @@ file(GLOB installToolchainModuleFiles ${CMAKE_SOURCE_DIR}/toolchain/*[^~]) install(FILES ${installToolchainModuleFiles} DESTINATION ${TOOLCHAIN_MODULES_INSTALL_DIR}) -include(CMakePackageConfigHelpers) - -configure_package_config_file(ECMConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake - INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} - PATH_VARS FIND_MODULES_INSTALL_DIR KDE_MODULES_INSTALL_DIR MODULES_INSTALL_DIR ) +# +# Config.cmake file +# +include(CMakePackageConfigHelpers) -write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake - VERSION ${ECM_MAJOR_VERSION}.${ECM_MINOR_VERSION}.${ECM_PATCH_VERSION} - COMPATIBILITY AnyNewerVersion ) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake - DESTINATION ${CMAKECONFIG_INSTALL_DIR}) - -# need to install a Config.cmake file +configure_package_config_file( + ECMConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake + INSTALL_DESTINATION + ${CMAKECONFIG_INSTALL_DIR} + PATH_VARS + FIND_MODULES_INSTALL_DIR + KDE_MODULES_INSTALL_DIR + MODULES_INSTALL_DIR +) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake + VERSION + "${PROJECT_VERSION}" + COMPATIBILITY + AnyNewerVersion +) + +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake + DESTINATION + ${CMAKECONFIG_INSTALL_DIR} +) + + +# +# Packaging +# -# set up packaging set(CPACK_PACKAGE_NAME extra-cmake-modules) -set(CPACK_PACKAGE_VERSION ${ECM_VERSION}) +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_SYSTEM_NAME "generic") set(CPACK_GENERATOR "TGZ") set(CPACK_SET_DESTDIR FALSE) include(CPack) + + +# +# Feature summary +# + +feature_summary( + FATAL_ON_MISSING_REQUIRED_PACKAGES + WHAT ALL +) diff --git a/ECMConfig.cmake.in b/ECMConfig.cmake.in index b163e3ae..f373cdc0 100644 --- a/ECMConfig.cmake.in +++ b/ECMConfig.cmake.in @@ -1,12 +1,5 @@ @PACKAGE_INIT@ -# set the version of myself -set(ECM_VERSION_MAJOR @ECM_MAJOR_VERSION@) -set(ECM_VERSION_MINOR @ECM_MINOR_VERSION@) -set(ECM_VERSION_PATCH @ECM_PATCH_VERSION@) -set(ECM_MODULES_VERSION ${ECM_VERSION_MAJOR}.${ECM_VERSION_MINOR}.${ECM_VERSION_PATCH}) - - set(ECM_FIND_MODULE_DIR "@PACKAGE_FIND_MODULES_INSTALL_DIR@") set(ECM_MODULE_DIR "@PACKAGE_MODULES_INSTALL_DIR@") diff --git a/cmake/FindQCollectionGenerator.cmake b/cmake/FindQCollectionGenerator.cmake new file mode 100644 index 00000000..315f5fae --- /dev/null +++ b/cmake/FindQCollectionGenerator.cmake @@ -0,0 +1,94 @@ +#.rst: +# FindQCollectionGenerator +# ------------------------ +# +# Try to find the Qt help collection generator. +# +# This will define the following variables: +# +# ``QCollectionGenerator_FOUND`` +# True if (the requested version of) Sphinx is available +# ``QCollectionGenerator_VERSION`` +# The version of the Qt help collection generator. Note that this not the +# same as the version of Qt it is provided by. +# ``QCollectionGenerator_QT_VERSION`` +# The version of Qt that the Qt help collection generator is from. +# ``QCollectionGenerator_EXECUTABLE`` +# The path to the Qt help collection generator executable. +# +# If ``QCollectionGenerator_FOUND`` is TRUE, it will also define the following +# imported target: +# +# ``QCollectionGenerator::Generator`` +# The Qt help collection generator. +# +# In general we recommend using the imported target, as it is easier to use. +# +# Since 5.17.0. + +#============================================================================= +# Copyright 2015 Alex Merry <alex.merry@kde.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +find_program(QCollectionGenerator_EXECUTABLE + NAMES + qcollectiongenerator + qcollectiongenerator-qt4 + qcollectiongenerator-qt5 + DOC "Qt help collection generator" +) + +if (QCollectionGenerator_EXECUTABLE) + if(NOT TARGET QCollectionGenerator::Generator) + add_executable(QCollectionGenerator::Generator IMPORTED) + set_target_properties(QCollectionGenerator::Generator PROPERTIES + IMPORTED_LOCATION "${QCollectionGenerator_EXECUTABLE}" + ) + endif() + + execute_process( + COMMAND "${QCollectionGenerator_EXECUTABLE}" -v + OUTPUT_VARIABLE _QCollectionGenerator_version_raw + ERROR_VARIABLE _QCollectionGenerator_version_raw + ) + if (_QCollectionGenerator_version_raw MATCHES "^Qt Collection Generator version ([0-9]+(\\.[0-9]+)*) \\(Qt ([0-9]+(\\.[0-9]+)*)\\)") + set(QCollectionGenerator_VERSION "${CMAKE_MATCH_1}") + set(QCollectionGenerator_QT_VERSION "${CMAKE_MATCH_3}") + endif() + unset(_QCollectionGenerator_version_raw) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(QCollectionGenerator + FOUND_VAR + QCollectionGenerator_FOUND + REQUIRED_VARS + QCollectionGenerator_EXECUTABLE + VERSION_VAR + QCollectionGenerator_VERSION +) + +mark_as_advanced(QCollectionGenerator_EXECUTABLE) diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake new file mode 100644 index 00000000..276f3a28 --- /dev/null +++ b/cmake/FindSphinx.cmake @@ -0,0 +1,91 @@ +#.rst: +# FindSphinx +# ---------- +# +# Try to find the Sphinx documentation builder. +# +# This will define the following variables: +# +# ``Sphinx_FOUND`` +# True if (the requested version of) Sphinx is available +# ``Sphinx_VERSION`` +# The version of the Sphinx documentation builder. +# ``Sphinx_BUILD_EXECUTABLE`` +# The path to the Sphinx documentation builder executable. +# +# If ``Sphinx_FOUND`` is TRUE, it will also define the following imported target: +# +# ``Sphinx::Build`` +# The Sphinx documentation builder. +# +# In general we recommend using the imported target, as it is easier to use. +# +# Since 5.17.0. + +#============================================================================= +# Copyright 2015 Alex Merry <alex.merry@kde.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Distros sometimes rename Python executables to allow for parallel +# installation of Python2 and Python3 versions +find_program(Sphinx_BUILD_EXECUTABLE + NAMES + sphinx-build + sphinx-build2 + sphinx-build3 + DOC "Sphinx Documentation Builder (http://sphinx-doc.org/)" +) + +if (Sphinx_BUILD_EXECUTABLE) + if(NOT TARGET Sphinx::Build) + add_executable(Sphinx::Build IMPORTED) + set_target_properties(Sphinx::Build PROPERTIES + IMPORTED_LOCATION "${Sphinx_BUILD_EXECUTABLE}" + ) + endif() + + execute_process( + COMMAND "${Sphinx_BUILD_EXECUTABLE}" --version + OUTPUT_VARIABLE _Sphinx_version_raw + ERROR_VARIABLE _Sphinx_version_raw + ) + if (_Sphinx_version_raw MATCHES "^Sphinx \\([^)]*\\) ([0-9]+(\\.[0-9]+)*)") + set(Sphinx_VERSION "${CMAKE_MATCH_1}") + endif() + unset(_Sphinx_version_raw) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sphinx + FOUND_VAR + Sphinx_FOUND + REQUIRED_VARS + Sphinx_BUILD_EXECUTABLE + VERSION_VAR + Sphinx_VERSION +) + +mark_as_advanced(Sphinx_BUILD_EXECUTABLE) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index f17400f8..1f307855 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,51 +1,55 @@ #============================================================================= -# CMake - Cross Platform Makefile Generator -# Copyright 2000-2013 Kitware, Inc., Insight Software Consortium -# Copyright 2014 Alex Merry <alex.merry@kde.org> +# Copyright 2000-2013 Kitware, Inc. +# Copyright 2014-2015 Alex Merry <alex.merry@kde.org> # # Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# see accompanying file COPYING-CMAKE-SCRIPTS for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# Distros sometimes rename Python executables to allow for parallel -# installation of Python2 and Python3 versions -message(STATUS "Looking for Sphinx Documentation Builder...") -find_program(SPHINX_EXECUTABLE - NAMES - sphinx-build - sphinx-build2 - sphinx-build3 - DOC "Sphinx Documentation Builder (http://sphinx-doc.org/)" +include(CMakeDependentOption) + +find_package(Sphinx 1.2 MODULE) +set_package_properties( + Sphinx + PROPERTIES + URL "http://sphinx-doc.org/" + DESCRIPTION "Tool to generate documentation." + TYPE OPTIONAL + PURPOSE "Required to build documentation for Extra CMake Modules." ) -if(SPHINX_EXECUTABLE) - message(STATUS "Sphinx Documentation Builder found at ${SPHINX_EXECUTABLE} - building documentation") - set(build_docs_default ON) -else() - message(STATUS "Sphinx Documentation Builder not found - documentation will not be built (see http://sphinx-doc.org/)") - set(build_docs_default OFF) -endif() -option(BUILD_HTML_DOCS "Build html help with Sphinx" ${build_docs_default}) -option(BUILD_MAN_DOCS "Build man pages with Sphinx" ${build_docs_default}) -option(BUILD_QTHELP_DOCS "Build Qt help with Sphinx" OFF) +find_package(QCollectionGenerator MODULE) +set_package_properties( + QCollectionGenerator + PROPERTIES + URL "http://www.qt.io/" + DESCRIPTION "Qt help collection generator." + TYPE OPTIONAL + PURPOSE "Required to build Extra CMake Modules documentation in Qt Help format." +) -if(NOT BUILD_HTML_DOCS AND NOT BUILD_MAN_DOCS AND NOT BUILD_QTHELP_DOCS) - return() -elseif(NOT SPHINX_EXECUTABLE) - message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) was not found!") -endif() +cmake_dependent_option( + BUILD_HTML_DOCS "Build html help with Sphinx" ON + "Sphinx_FOUND" OFF +) +add_feature_info(BUILD_HTML_DOCS BUILD_HTML_DOCS "Generate HTML documentation for installed modules.") + +cmake_dependent_option( + BUILD_MAN_DOCS "Build man pages with Sphinx" ON + "Sphinx_FOUND" OFF +) +add_feature_info(BUILD_MAN_DOCS BUILD_MAN_DOCS "Generate man page documentation for installed modules.") + +cmake_dependent_option( + BUILD_QTHELP_DOCS "Build Qt help with Sphinx" OFF + "Sphinx_FOUND;QCollectionGenerator_FOUND" OFF +) +add_feature_info(BUILD_QTHELP_DOCS BUILD_QTHELP_DOCS "Generate QtHelp documentation for installed modules.") -# the docs/ directory -set(conf_docs "${CMAKE_CURRENT_SOURCE_DIR}") -# where cmake.py and other sphinx files are -set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}/sphinx") -set(conf_version "${extra-cmake-modules_VERSION_MAJOR}.${extra-cmake-modules_VERSION_MINOR}.${extra-cmake-modules_VERSION_PATCH}") -set(conf_release "${extra-cmake-modules_VERSION}") -configure_file(sphinx/conf.py.in conf.py @ONLY) set(doc_formats "") if(BUILD_HTML_DOCS) @@ -55,22 +59,26 @@ if(BUILD_MAN_DOCS) list(APPEND doc_formats man) endif() if(BUILD_QTHELP_DOCS) - find_program(QCOLLECTIONGENERATOR_EXECUTABLE - NAMES qcollectiongenerator - DOC "qcollectiongenerator tool" - ) - if (NOT QCOLLECTIONGENERATOR_EXECUTABLE) - message(FATAL_ERROR "QCOLLECTIONGENERATOR_EXECUTABLE (qcollectiongenerator) not found!") - endif() list(APPEND doc_formats qthelp) - set(qthelp_extra_commands COMMAND - qcollectiongenerator - ${CMAKE_CURRENT_BINARY_DIR}/qthelp/extra-cmake-modules.qhcp + QCollectionGenerator::Generator + ${CMAKE_CURRENT_BINARY_DIR}/qthelp/ExtraCMakeModules.qhcp ) endif() +if(NOT doc_formats) + return() +endif() + +if (Sphinx_VERSION VERSION_LESS 1.3) + set(sphinx_theme default) +else() + set(sphinx_theme classic) +endif() +configure_file(sphinx/conf.py.in conf.py @ONLY) +configure_file(sphinx/ecm.css.in static/ecm.css) + set(doc_format_outputs "") set(doc_format_last "") @@ -80,13 +88,14 @@ foreach(format ${doc_formats}) add_custom_command( OUTPUT ${doc_format_output} COMMAND - ${SPHINX_EXECUTABLE} + Sphinx::Build -c ${CMAKE_CURRENT_BINARY_DIR} -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees -b ${format} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr + ${${format}_extra_commands} DEPENDS ${doc_format_last} COMMENT "sphinx-build ${format}: see ${CMAKE_CURRENT_BINARY_DIR}/${doc_format_log}" VERBATIM @@ -99,8 +108,8 @@ endforeach() add_custom_target(documentation ALL DEPENDS ${doc_format_outputs}) if(BUILD_MAN_DOCS) - file(GLOB man_rst RELATIVE ${extra-cmake-modules_SOURCE_DIR}/docs/manual - ${extra-cmake-modules_SOURCE_DIR}/docs/manual/*.[1-9].rst) + file(GLOB man_rst RELATIVE ${ECM_SOURCE_DIR}/docs/manual + ${ECM_SOURCE_DIR}/docs/manual/*.[1-9].rst) foreach(m ${man_rst}) if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$") set(name "${CMAKE_MATCH_1}") @@ -122,7 +131,7 @@ if(BUILD_HTML_DOCS) endif() if(BUILD_QTHELP_DOCS) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/extra-cmake-modules.qch + FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/ExtraCMakeModules.qch DESTINATION ${DOC_INSTALL_DIR} ) endif() diff --git a/docs/sphinx/conf.py.in b/docs/sphinx/conf.py.in index 792c87ca..d32b53f4 100644 --- a/docs/sphinx/conf.py.in +++ b/docs/sphinx/conf.py.in @@ -14,24 +14,23 @@ import os import re import glob -sys.path.insert(0, r'@conf_path@') +sys.path.insert(0, r'@CMAKE_CURRENT_SOURCE_DIR@/sphinx/ext') source_suffix = '.rst' master_doc = 'index' project = 'Extra CMake Modules' copyright = 'KDE Developers' -version = '@conf_version@' # feature version -release = '@conf_release@' # full version string +version = '@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@' # feature version +release = '@PROJECT_VERSION@' # full version string primary_domain = 'ecm' exclude_patterns = [] extensions = ['ecm'] -templates_path = ['@conf_path@/templates'] -ecm_manuals = sorted(glob.glob(r'@conf_docs@/manual/*.rst')) +ecm_manuals = sorted(glob.glob(r'@CMAKE_CURRENT_SOURCE_DIR@/manual/*.rst')) ecm_manual_description = re.compile('^\.\. ecm-manual-description:(.*)$') man_pages = [] for fpath in ecm_manuals: @@ -55,9 +54,8 @@ for fpath in ecm_manuals: man_show_urls = False html_show_sourcelink = True -html_static_path = ['@conf_path@/static'] +html_static_path = ['@CMAKE_CURRENT_BINARY_DIR@/static'] html_style = 'ecm.css' -html_theme = 'default' -html_title = 'Extra CMake Modules %s Documentation' % release -html_short_title = '%s Documentation' % release -html_favicon = '@conf_path@/kde-favicon.ico' +html_theme = '@sphinx_theme@' +html_short_title = 'ECM %s documentation' % version +html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/sphinx/kde-favicon.ico' diff --git a/docs/sphinx/static/ecm.css b/docs/sphinx/ecm.css.in index 2a326d47..a05e4527 100644 --- a/docs/sphinx/static/ecm.css +++ b/docs/sphinx/ecm.css.in @@ -1,5 +1,5 @@ /* Import the Sphinx theme style. */ -@import url("default.css"); +@import url("${sphinx_theme}.css"); /* Wrap sidebar content even within words so that long document names do not escape sidebar borders. */ diff --git a/docs/sphinx/ecm.py b/docs/sphinx/ext/ecm.py index ed966bfb..ed966bfb 100644 --- a/docs/sphinx/ecm.py +++ b/docs/sphinx/ext/ecm.py diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9e6de12f..1a66f563 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,41 @@ +#============================================================================= +# Copyright 2011 Alex Neundorf <neundorf@kde.org> +# Copyright 2014-2015 Alex Merry <alex.merry@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file COPYING-CMAKE-SCRIPTS for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + # We need to set a language to find CMake packages installed in # architecture-dependent locations (like /usr/lib64). # We only set this for the tests, making sure it does not interfere # with other files (as ECM itself is architecture-independent). project(ECMTests C) +find_package(Qt5LinguistTools CONFIG) +set_package_properties( + Qt5LinguistTools + PROPERTIES + URL "http://www.qt.io/" + DESCRIPTION "Qt5 linguist tools." + TYPE OPTIONAL + PURPOSE "Required to run tests for the ECMPoQmTools module." +) + +find_package(Qt5Core CONFIG) +set_package_properties( + Qt5Core + PROPERTIES + URL "http://www.qt.io/" + DESCRIPTION "Qt5 core library." + TYPE OPTIONAL + PURPOSE "Required to run tests for the ECMQtDeclareLoggingCategory module, and for some tests of the KDEInstallDirs module." +) + add_subdirectory(ECMAddTests) add_subdirectory(ECMGenerateHeadersTest) add_subdirectory(ECMSetupVersionTest) @@ -30,8 +62,6 @@ macro(add_test_macro NAME) add_test_variant("${NAME}" "${NAME}" ${ARGN}) endmacro() -find_package(Qt5LinguistTools CONFIG) - add_test_macro(ExecuteCoreModules dummy) add_test_macro(ExecuteKDEModules dummy) @@ -73,7 +103,6 @@ set(KDEInstallDirsTest.relative_or_absolute_usr_EXTRA_OPTIONS add_test_variant(KDEInstallDirsTest.relative_or_absolute_usr KDEInstallDirsTest.relative_or_absolute dummy) -find_package(Qt5Core QUIET) if (TARGET Qt5::qmake) set(KDEInstallDirsTest.relative_or_absolute_qt_EXTRA_OPTIONS --build-options -DKDE_INSTALL_USE_QT_SYS_PATHS=TRUE diff --git a/tests/ECMGenerateHeadersTest/CMakeLists.txt b/tests/ECMGenerateHeadersTest/CMakeLists.txt index 9f407cb0..abf32cfb 100644 --- a/tests/ECMGenerateHeadersTest/CMakeLists.txt +++ b/tests/ECMGenerateHeadersTest/CMakeLists.txt @@ -1,4 +1,4 @@ -set(MODULES_DIR "${extra-cmake-modules_SOURCE_DIR}/modules") +set(MODULES_DIR "${ECM_SOURCE_DIR}/modules") configure_file(run_test.cmake.config "${CMAKE_CURRENT_BINARY_DIR}/run_test.cmake" @ONLY) add_test( diff --git a/tests/ECMGeneratePkgConfigFile/CMakeLists.txt b/tests/ECMGeneratePkgConfigFile/CMakeLists.txt index f3bc267d..6d6ea4e0 100644 --- a/tests/ECMGeneratePkgConfigFile/CMakeLists.txt +++ b/tests/ECMGeneratePkgConfigFile/CMakeLists.txt @@ -1,4 +1,4 @@ -set(MODULES_DIR "${extra-cmake-modules_SOURCE_DIR}/modules") +set(MODULES_DIR "${ECM_SOURCE_DIR}/modules") configure_file(run_test.cmake.config "${CMAKE_CURRENT_BINARY_DIR}/run_test.cmake" @ONLY) add_test( |