Skip to content

Commit

Permalink
CMake - Rename cmake modules for clarity
Browse files Browse the repository at this point in the history
This also moves the html rules to a separate file
  • Loading branch information
gjanssens committed Sep 7, 2019
1 parent 4706082 commit 2c6180f
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 41 deletions.
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ set (PACKAGE_URL "https://www.gnucash.org/")

# Extra cmake macros
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
include (xmldocs)
include (pdf)
include (epub)
include (gnc_doc_targets)
include (dist)
include (AddEpubTarget)
include (AddHtmlTarget)
include (AddPdfTarget)
include (AddXmlTarget)
include (AddGncDocTargets)
include (DistCommon)
include (GNUInstallDirs)

# Clear cache variables that will be filled later during the cmake run
Expand Down
File renamed without changes.
File renamed without changes.
35 changes: 1 addition & 34 deletions cmake/xmldocs.cmake → cmake/AddHtmlTarget.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Functions to generate xml (docbook) or html documentation
# Functions to generate html documentation
#
# Paremeters:
# - docname: basename of the main xml file. Will be used to locate
Expand All @@ -8,39 +8,6 @@
# - entities: list of all xml files this document is composed of
# - figdir: name of the directory holding the images

# ************** Rules to install xml files for gnome-help ***********************
function (add_xml_target docname lang entities figdir)

set(xml_files "${entities}")
list(APPEND xml_files "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
file(GLOB figures "${CMAKE_CURRENT_SOURCE_DIR}/${figdir}/*.png")

install(FILES ${xml_files}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}"
COMPONENT "${lang}-${docname}-xml")
install(FILES ${figures}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}/${figdir}"
COMPONENT "${lang}-${docname}-xml")

add_custom_target("${lang}-${docname}-check"
COMMAND ${XMLLINT} --postvalid
--xinclude
--noout
--path ${CMAKE_SOURCE_DIR}/docbook
${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")

add_dependencies(${docname}-check "${lang}-${docname}-check")

# TODO Uninstall and dist targets
# uninstall-hook:
# rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(gnomehelpfiguresdir)"
# rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(gnomehelpdir)"
#
# EXTRA_DIST = ${xml_files} ${omffile} ${figures}
endfunction()

# ************** Rules to make and install html documentation ********************
function (add_html_target docname lang entities figdir)

file(GLOB figures "${CMAKE_CURRENT_SOURCE_DIR}/${figdir}/*.png")
Expand Down
File renamed without changes.
41 changes: 41 additions & 0 deletions cmake/AddXmlTarget.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Functions to generate xml (docbook) documentation
#
# Paremeters:
# - docname: basename of the main xml file. Will be used to locate
# this primary xml file and for various output files/directories
# - lang: language of the current document
# - entities: list of all xml files this document is composed of
# - figdir: name of the directory holding the images

# ************** Rules to install xml files for gnome-help ***********************
function (add_xml_target docname lang entities figdir)

set(xml_files "${entities}")
list(APPEND xml_files "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
file(GLOB figures "${CMAKE_CURRENT_SOURCE_DIR}/${figdir}/*.png")

install(FILES ${xml_files}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}"
COMPONENT "${lang}-${docname}-xml")
install(FILES ${figures}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}/${figdir}"
COMPONENT "${lang}-${docname}-xml")

add_custom_target("${lang}-${docname}-check"
COMMAND ${XMLLINT} --postvalid
--xinclude
--noout
--path ${CMAKE_SOURCE_DIR}/docbook
${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")

add_dependencies(${docname}-check "${lang}-${docname}-check")

# TODO Uninstall and dist targets
# uninstall-hook:
# rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(gnomehelpfiguresdir)"
# rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(gnomehelpdir)"
#
# EXTRA_DIST = ${xml_files} ${omffile} ${figures}
endfunction()
File renamed without changes.
2 changes: 1 addition & 1 deletion cmake/MakeDist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 3. Create the tarball and compress it with gzip and bzip2.
# 4. Then remove the dist directory.

include(${CMAKE_MODULE_PATH}/dist.cmake)
include(${CMAKE_MODULE_PATH}/DistCommon.cmake)

function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR)

Expand Down
2 changes: 1 addition & 1 deletion cmake/MakeDistCheck.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

include(${CMAKE_MODULE_PATH}/dist.cmake)
include(${CMAKE_MODULE_PATH}/DistCommon.cmake)

function(run_dist_check PACKAGE_PREFIX EXT)

Expand Down

0 comments on commit 2c6180f

Please sign in to comment.