From a6b4be252261647afd1cdc04a839331261bb3e8a Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub <vvaintroub@mysql.com>
Date: Sat, 13 Nov 2010 23:16:52 +0100
Subject: [PATCH] add missing COMPONENT to all CMake INSTALL commands

---
 CMakeLists.txt               | 13 +++++++++----
 cmake/install_macros.cmake   | 11 ++++-------
 libmysql/CMakeLists.txt      |  6 +++---
 libservices/CMakeLists.txt   |  2 +-
 man/CMakeLists.txt           |  6 ++++--
 mysql-test/CMakeLists.txt    |  3 ++-
 scripts/CMakeLists.txt       |  2 +-
 sql-bench/CMakeLists.txt     | 10 +++++-----
 sql/CMakeLists.txt           |  2 +-
 support-files/CMakeLists.txt | 11 ++++++++---
 10 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4078e520a08..6c7e89974c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -338,21 +338,26 @@ SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "")
 
 INCLUDE(CPack)
 IF(UNIX)
-  INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL)
+  INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info)
 ENDIF()
 #
 # RPM installs documentation directly from the source tree
 #
 IF(NOT INSTALL_LAYOUT MATCHES "RPM")
-  INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
-  INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
+  INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql 
+  DESTINATION ${INSTALL_DOCREADMEDIR} 
+  COMPONENT Readme
+  OPTIONAL
+  )
+  INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
   IF(UNIX)
-    INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR})
+    INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
   ENDIF()
   # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
   SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
   MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
   INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
+    COMPONENT Documentation
     PATTERN "INSTALL-BINARY" EXCLUDE
     PATTERN "Makefile.*" EXCLUDE
     PATTERN "glibc*" EXCLUDE
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index ddfbcd09ce4..e244e4262e0 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -78,7 +78,9 @@ FUNCTION(INSTALL_MANPAGE file)
     ELSE()
       SET(SECTION man8)
     ENDIF()
-    INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}")
+    MESSAGE("huj!")
+    INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
+      COMPONENT ManPages)
   ENDIF()
 ENDFUNCTION()
 
@@ -137,12 +139,7 @@ IF(UNIX)
     STRING(REPLACE "${CMAKE_CFG_INTDIR}" 
       "\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
   ENDIF()
-  IF(component)
-    SET(COMP COMPONENT ${component})
-  ELSE()  
-    SET(COMP)
-  ENDIF()
-  INSTALL(FILES ${output} DESTINATION ${destination} ${COMP})
+  INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component})
 ENDIF()
 ENDMACRO()
 
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 7441423743e..d7426c465d8 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -172,7 +172,7 @@ IF(UNIX)
       SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
     ENDIF() 
   ENDMACRO()
-  INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+  INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
 ENDIF()
 
 IF(NOT DISABLE_SHARED)
@@ -210,7 +210,7 @@ IF(NOT DISABLE_SHARED)
       "${CMAKE_SHARED_LIBRARY_SUFFIX}"
       ""
       linkname)
-    INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+    INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
     SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
     LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
     FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
@@ -219,7 +219,7 @@ IF(NOT DISABLE_SHARED)
         "${CMAKE_SHARED_LIBRARY_SUFFIX}"
         "${ver}"
         linkname)
-      INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
+      INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
     ENDFOREACH()
   ENDIF()
 ENDIF()
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 396430fba12..300e0ce32a3 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -22,4 +22,4 @@ SET(MYSQLSERVICES_SOURCES
   my_thread_scheduler_service.c)
 
 ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
-INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR})
+INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 7c96deada08..135d66634e4 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -21,8 +21,10 @@ IF(MAN1_FILES)
   IF(MAN1_EXCLUDE)
     LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE})
   ENDIF()
-  INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1)
+  INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1
+  COMPONENT ManPages)
 ENDIF()
 IF(MAN8_FILES)
-  INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8)
+  INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8
+  COMPONENT ManPages)
 ENDIF()
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index 3c38e5772d0..f18b2ae341c 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -53,7 +53,8 @@ IF(UNIX)
   IF(INSTALL_MYSQLTESTDIR)
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr 
       ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run 
-      DESTINATION ${INSTALL_MYSQLTESTDIR})
+      DESTINATION ${INSTALL_MYSQLTESTDIR}
+      COMPONENT Test)
   ENDIF()
 ENDIF()
 
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 0a8d4f9658d..56b7f779bb0 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -310,7 +310,7 @@ IF(WIN32)
   FOREACH(file ${SH_FILES})
     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
        ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
-    INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT ${${file}_COMPONENT})
+    INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT Server_Scripts)
   ENDFOREACH()
 ELSE()
   # On Unix, most of the files end up in the bin directory
diff --git a/sql-bench/CMakeLists.txt b/sql-bench/CMakeLists.txt
index f8be18c6653..ae05d30530d 100644
--- a/sql-bench/CMakeLists.txt
+++ b/sql-bench/CMakeLists.txt
@@ -26,13 +26,13 @@ ELSE()
 ENDIF()
 
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/ATIS
-  DESTINATION  ${prefix}sql-bench/Data)
+  DESTINATION  ${prefix}sql-bench/Data COMPONENT SqlBench)
 
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/Wisconsin
-  DESTINATION  ${prefix}sql-bench/Data)
+  DESTINATION  ${prefix}sql-bench/Data COMPONENT SqlBench)
 
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/limits
-  DESTINATION  ${prefix}sql-bench)
+  DESTINATION  ${prefix}sql-bench COMPONENT SqlBench)
 
 FILE(GLOB all_files ${CMAKE_CURRENT_SOURCE_DIR}/*)
 
@@ -54,10 +54,10 @@ FOREACH(file ${all_files})
   CONFIGURE_FILE(${file} ${target} COPYONLY)
   IF (ext MATCHES ".bat")
     IF(WIN32) 
-      INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
+      INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench COMPONENT SqlBench)
     ENDIF()
   ELSE()
-    INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
+    INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench COMPONENT SqlBench)
   ENDIF()
   ENDIF()
 ENDFOREACH()
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 0860adde652..2c782380baf 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -283,7 +283,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
   COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE  PATTERN "bootstrap.sql" EXCLUDE)
 ELSE()
   # Not windows or cross compiling, just install an empty directory
-  INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql)
+  INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
 ENDIF()
 ENDIF()
 
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index ef676c8ee2a..26aa7ad81ad 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -61,12 +61,17 @@ IF(UNIX)
     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh 
                    ${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
 
+    IF(script MATCHES ".ini")
+      SET(comp IniFiles)
+    ELSE()
+      SET(comp Server_Scripts)
+    ENDIF()
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${script} 
-       DESTINATION ${inst_location}
+       DESTINATION ${inst_location} COMPONENT ${comp}
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
   ENDFOREACH()
   IF(INSTALL_SUPPORTFILESDIR)
-    INSTALL(FILES magic DESTINATION ${inst_location})
+    INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles)
   ENDIF()
 
   INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
@@ -83,7 +88,7 @@ IF(UNIX)
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh 
                  ${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
   INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.server 
-    DESTINATION ${inst_location}
+    DESTINATION ${inst_location} COMPONENT SupportFiles
     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ 
     GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 ENDIF()
-- 
2.30.9