[waffle] [PATCH 02/10] cmake: reformat/update install targets

Emil Velikov emil.l.velikov at gmail.com
Fri May 30 19:22:00 PDT 2014


Cleanup the formatting and add component for each build target.
The latter will allow us to use CPack to create a component
based installer for Windows.
Additionally install wflinfo to CMAKE_INSTALL_BINDIR rather
than hardcoding it to 'bin'.

v2: Tag html documentation as htmldocs COMPONENT. Suggested by Chad.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 CMakeLists.txt            | 14 ++++++++++----
 doc/CMakeLists.txt        | 19 +++++++++++++------
 examples/CMakeLists.txt   | 12 ++++++++----
 include/CMakeLists.txt    | 18 +++++++++++-------
 man/html.cmake            |  7 +++++--
 man/manpages.cmake        | 21 +++++++++++++++------
 src/utils/CMakeLists.txt  |  6 +++++-
 src/waffle/CMakeLists.txt |  7 +++++--
 8 files changed, 72 insertions(+), 32 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8d234d..b32b3d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,11 +92,17 @@ endif()
 
 configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
 
-install(FILES ${CMAKE_BINARY_DIR}/${waffle_libname}.pc
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+install(
+    FILES ${CMAKE_BINARY_DIR}/${waffle_libname}.pc
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+    COMPONENT pkgconfig
+    )
 
-install(FILES cmake/Modules/FindWaffle.cmake
-        DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules")
+install(
+    FILES cmake/Modules/FindWaffle.cmake
+    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules"
+    COMPONENT cmakefind
+    )
 
 # ------------------------------------------------------------------------------
 
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index b89fde3..a2d46e6 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,7 +1,14 @@
-install(FILES "${CMAKE_SOURCE_DIR}/README.txt"
-              "${CMAKE_SOURCE_DIR}/LICENSE.txt"
-        DESTINATION "${CMAKE_INSTALL_DOCDIR}")
+install(
+    FILES
+        "${CMAKE_SOURCE_DIR}/README.txt"
+        "${CMAKE_SOURCE_DIR}/LICENSE.txt"
+    DESTINATION "${CMAKE_INSTALL_DOCDIR}"
+    COMPONENT coredocs
+    )
 
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/doc/release-notes"
-        DESTINATION "${CMAKE_INSTALL_DOCDIR}"
-        FILES_MATCHING PATTERN "waffle-${waffle_major_version}.${waffle_minor_version}.*.txt")
+install(
+    DIRECTORY "${CMAKE_SOURCE_DIR}/doc/release-notes"
+    DESTINATION "${CMAKE_INSTALL_DOCDIR}"
+    COMPONENT releasenotes
+    FILES_MATCHING PATTERN "waffle-${waffle_major_version}.${waffle_minor_version}.*.txt"
+    )
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 410bbf8..8392ecb 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,7 +1,11 @@
-install(FILES Makefile.example
-              gl_basic.c
-              simple-x11-egl.c
-        DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
+install(
+    FILES
+        Makefile.example
+        gl_basic.c
+        simple-x11-egl.c
+    DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples"
+    COMPONENT examples
+    )
 
 # ----------------------------------------------------------------------------
 # Target: simple-x11-egl (executable)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 0123c28..e190a76 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -2,10 +2,14 @@ configure_file(waffle/waffle_version.h.in
                ${CMAKE_CURRENT_SOURCE_DIR}/waffle/waffle_version.h
                @ONLY)
 
-install(FILES waffle/waffle.h
-              waffle/waffle_gbm.h
-              waffle/waffle_glx.h
-              waffle/waffle_version.h
-              waffle/waffle_wayland.h
-              waffle/waffle_x11_egl.h
-        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${waffle_libname})
+install(
+    FILES
+        waffle/waffle.h
+        waffle/waffle_gbm.h
+        waffle/waffle_glx.h
+        waffle/waffle_version.h
+        waffle/waffle_wayland.h
+        waffle/waffle_x11_egl.h
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${waffle_libname}
+    COMPONENT headers
+    )
diff --git a/man/html.cmake b/man/html.cmake
index ea55600..59e0490 100644
--- a/man/html.cmake
+++ b/man/html.cmake
@@ -92,5 +92,8 @@ add_custom_target(html
     DEPENDS ${html_outputs}
     )
 
-install(DIRECTORY ${html_out_dir}
-        DESTINATION ${CMAKE_INSTALL_DOCDIR}/html)
+install(
+    DIRECTORY ${html_out_dir}
+    DESTINATION ${CMAKE_INSTALL_DOCDIR}/html
+    COMPONENT htmldocs
+    )
diff --git a/man/manpages.cmake b/man/manpages.cmake
index 1332eb9..b8ededa 100644
--- a/man/manpages.cmake
+++ b/man/manpages.cmake
@@ -92,9 +92,18 @@ add_custom_target(man
     DEPENDS ${man_outputs}
     )
 
-install(DIRECTORY ${man_out_dir}/man1
-        DESTINATION ${CMAKE_INSTALL_MANDIR})
-install(DIRECTORY ${man_out_dir}/man3
-        DESTINATION ${CMAKE_INSTALL_MANDIR})
-install(DIRECTORY ${man_out_dir}/man7
-        DESTINATION ${CMAKE_INSTALL_MANDIR})
+install(
+    DIRECTORY ${man_out_dir}/man1
+    DESTINATION ${CMAKE_INSTALL_MANDIR}
+    COMPONENT manuals
+    )
+install(
+    DIRECTORY ${man_out_dir}/man3
+    DESTINATION ${CMAKE_INSTALL_MANDIR}
+    COMPONENT manuals
+    )
+install(
+    DIRECTORY ${man_out_dir}/man7
+    DESTINATION ${CMAKE_INSTALL_MANDIR}
+    COMPONENT manuals
+    )
diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt
index 5bdf9c4..848702c 100644
--- a/src/utils/CMakeLists.txt
+++ b/src/utils/CMakeLists.txt
@@ -16,4 +16,8 @@ if(waffle_on_mac)
         )
 endif()
 
-install(TARGETS wflinfo DESTINATION bin)
+install(
+    TARGETS wflinfo
+    DESTINATION ${CMAKE_INSTALL_BINDIR}
+    COMPONENT utils
+    )
diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index 10a0241..12cc567 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -175,8 +175,11 @@ set_target_properties(${waffle_libname}
     LINK_INTERFACE_LIBRARIES ""
     )
 
-install(TARGETS ${waffle_libname}
-        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(
+    TARGETS ${waffle_libname}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    COMPONENT libraries
+    )
 
 # ----------------------------------------------------------------------------
 # Target: waffle_static
-- 
1.9.3



More information about the waffle mailing list