KiCadDocumentation.cmake: fix install target for HTML docu
authorCarsten Schoenert <c.schoenert@t-online.de>
Sun, 25 Sep 2016 07:56:25 +0000 (09:56 +0200)
committerCarsten Schoenert <c.schoenert@t-online.de>
Wed, 25 Jan 2017 21:38:35 +0000 (21:38 +0000)
The old default behaviour while installing the generated HTML content is
to install the whole images/$LANG folders into every generated language.
This was producing a lot of useless duplicated data.  After applying a
commit from upstream [1] this problem was partially fixed, but the
default images were not installed.

This commit fixes changing the kind of creating the list for the default
images that will be installed in a next step. Also the images from the
English language is needed as some howtos use them.

[1] https://github.com/KiCad/kicad-doc/commit/027c096941105048da8921ac2d8bc4d1594b14a9

Gbp-Pq: Topic fixes
Gbp-Pq: Name KiCadDocumentation.cmake-fix-install-target-for-HTML-docu.patch

doc/CMakeModules/KiCadDocumentation.cmake

index 884f46bf33311d08d619d0b9761a72af10e59ede..8c80b030e64531c23f71421b02cb0060ebe0ab70 100644 (file)
@@ -136,14 +136,20 @@ macro( KiCadDocumentation DOCNAME )
             add_dependencies( ${DOCNAME} ${DOCNAME}_html_${LANGUAGE} )
 
             install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/${DOCNAME}.html DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE} COMPONENT html-${LANGUAGE} )
+            # install the images/en/ folder if not already done, the folder contains the default images
+            if( NOT "${KICAD_DOC_PATH}/${LANGUAGE}/images/en" EQUAL "-1" )
+                install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/images/en DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE}/images COMPONENT html-${LANGUAGE} OPTIONAL PATTERN "*.png")
+            endif()
 
-            # It seems to be nescesary to use diffrent install commands to
-            # install the images properly without having other lagunages
-            # polluting the images folder
+            # collectings the default *.png files from the source tree and install them
+            file( GLOB COMMONPNGFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/images" "${CMAKE_CURRENT_SOURCE_DIR}/images/*.png" )
+            foreach( PNGFILE ${COMMONPNGFILES} )
+                # install the common used images into the root images folder
+                install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/images/${PNGFILE} DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE}/images COMPONENT html-${LANGUAGE} )
+            endforeach()
+            # install the specific images from the desired language
             install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/images/${LANGUAGE} DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE}/images COMPONENT html-${LANGUAGE} OPTIONAL PATTERN "*.png")
             install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/images/icons DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE}/images COMPONENT html-${LANGUAGE} OPTIONAL PATTERN "*.png")
-            file(GLOB UNIVERSAL_IMAGES "${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGE}/images/*.png")
-            install( FILES ${UNIVERSAL_IMAGES} DESTINATION ${KICAD_DOC_PATH}/${LANGUAGE}/images COMPONENT html-${LANGUAGE} )
         endif()