Fixed install-xxx functionality broken in 9628e27d
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 13 Oct 2012 00:00:48 +0000 (11:00 +1100)
committerMark Abraham <mark.j.abraham@gmail.com>
Sat, 13 Oct 2012 00:00:48 +0000 (11:00 +1100)
Only the CPack component definitions needed fixing, inasmuch as they
are what is used for the "make install-xxx" functionality. I separated
"libraries" component into "libraries", "libraries-gmxpreprocess" and
"libraries-gmxana" for, respectively, the core gmx/md/etc. libraries,
and those particular to src/kernel programs and src/tools programs.
Now "make install-xxx" correctly compiles, links and installs only the
required dependencies, and the wrong dependencies introduced in the
above commit are removed.

Fixes #1015

Change-Id: I3e848e69d126305943370d1f294e44d5389e1934

src/kernel/CMakeLists.txt
src/tools/CMakeLists.txt

index cb5d998dee7fd5c162bda5c04aaf15d2698e7cbd..2a8408f0b6cb9935d6757c31453df9520bc8e853 100644 (file)
@@ -93,22 +93,26 @@ if(GMX_OPENMM AND MSVC)
     set_target_properties(mdrun PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
 endif()
 
-# Construct component groups for installation
-foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
+# Construct component groups for installation; note that a component may
+# belong to only one group
+foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
     set(CPACK_COMPONENT_${PROGRAM}_GROUP tools)
 endforeach()
 set(CPACK_COMPONENT_MDRUN_GROUP mdrun)
 
-# Create custom install-xxxx targets, component dependences,
-# and trigger the installation
 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
-    set(CPACK_COMPONENT_${PROGRAM}_DEPENDS libraries)
+    # Manage CPack component dependencies
+    set(CPACK_COMPONENT_${PROGRAM}_DEPENDS libraries libraries-gmxpreprocess)
+
+    # Create custom install-xxxx target
     if (BUILD_SHARED_LIBS)
     # If shared libraries are used, we need to install the libraries in
     # addition to the mdrun binary.
        add_custom_target(install-${PROGRAM}
            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+           COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries-gmxpreprocess
+                   -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
            COMMENT "Installing ${PROGRAM}")
@@ -119,6 +123,8 @@ foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
            COMMENT "Installing ${PROGRAM}")
     endif()
     add_dependencies(install-${PROGRAM} ${PROGRAM})
+
+    # Finally, trigger installation
     install(
       TARGETS ${PROGRAM}
       COMPONENT ${PROGRAM}
@@ -126,7 +132,7 @@ foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
       )
 endforeach()
 
-install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
+install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries-gmxpreprocess)
 
 endif(GMX_FAHCORE)
 
index 4c07ad9c5e50e3ed7fe5a11ca567227d7649c7e2..27d12639d497efb7936e82811bddc6aa8f59f7a1 100644 (file)
@@ -75,16 +75,20 @@ foreach(TOOL ${GMX_TOOLS_PROGRAMS})
         gmx_add_man_page(${TOOL})
     endif()
 
-    # Create custom install-xxxx targets, manage components and
-    # component groups, and trigger the installation
-    set(CPACK_COMPONENT_${TOOL}_DEPENDS libraries)
+    # Manage CPack component dependencies, and group membership; note that
+    # a component may belong to only one group
+    set(CPACK_COMPONENT_${TOOL}_DEPENDS libraries libraries-gmxana)
     set(CPACK_COMPONENT_${TOOL}_GROUP tools)
+
+    # Create custom install-xxxx target
     if (BUILD_SHARED_LIBS)
     # If shared libraries are used, we need to install the libraries in
     # addition to the tool binary.
        add_custom_target(install-${TOOL}
            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+           COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries-gmxana
+                   -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${TOOL}
                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
            COMMENT "Installing ${TOOL}")
@@ -95,6 +99,8 @@ foreach(TOOL ${GMX_TOOLS_PROGRAMS})
            COMMENT "Installing ${TOOL}")
     endif()
     add_dependencies(install-${TOOL} ${TOOL})
+
+    # Finally, trigger installation
     install(
       TARGETS ${TOOL}
       COMPONENT ${TOOL}
@@ -102,7 +108,7 @@ foreach(TOOL ${GMX_TOOLS_PROGRAMS})
       )
 endforeach()
 
-install(TARGETS gmxana DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
+install(TARGETS gmxana DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries-gmxana)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxana.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxana.pc @ONLY)
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxana.pc