Skip to main content
added 3 characters in body
Source Link
Met
  • 3.2k
  • 4
  • 27
  • 43

One could provide a CMake attribute e.g. COMPONENT which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the COMPONENT is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${COMPONENT})
  set (CPACK_PACKAGE_NAME ${COMPONENT})
  set (CPACK_COMPONENT_${COMPONENT}_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_COMPONENT_${COMPONENT}_DESCRIPTION "${COMPONENT}")  
  set (CPACK_NSIS_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_NSIS_PACKAGE_NAME "${COMPONENT}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -COMPONENT=COMPONENT_1DCOMPONENT=COMPONENT_1 ../
nmake package
cmake -COMPONENT=COMPONENT_2DCOMPONENT=COMPONENT_2 ../
nmake package
...
cmake -COMPONENT=COMPONENT_XDCOMPONENT=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested COMPONENT(aka COMPONENT)

One could provide a CMake attribute e.g. COMPONENT which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the COMPONENT is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${COMPONENT})
  set (CPACK_PACKAGE_NAME ${COMPONENT})
  set (CPACK_COMPONENT_${COMPONENT}_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_COMPONENT_${COMPONENT}_DESCRIPTION "${COMPONENT}")  
  set (CPACK_NSIS_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_NSIS_PACKAGE_NAME "${COMPONENT}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -COMPONENT=COMPONENT_1 ../
nmake package
cmake -COMPONENT=COMPONENT_2 ../
nmake package
...
cmake -COMPONENT=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested COMPONENT(aka COMPONENT)

One could provide a CMake attribute e.g. COMPONENT which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the COMPONENT is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${COMPONENT})
  set (CPACK_PACKAGE_NAME ${COMPONENT})
  set (CPACK_COMPONENT_${COMPONENT}_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_COMPONENT_${COMPONENT}_DESCRIPTION "${COMPONENT}")  
  set (CPACK_NSIS_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_NSIS_PACKAGE_NAME "${COMPONENT}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -DCOMPONENT=COMPONENT_1 ../
nmake package
cmake -DCOMPONENT=COMPONENT_2 ../
nmake package
...
cmake -DCOMPONENT=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested COMPONENT(aka COMPONENT)

added 28 characters in body
Source Link
Met
  • 3.2k
  • 4
  • 27
  • 43

One could provide a CMake attribute e.g. UI_PACKCOMPONENT which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the UI_PACKCOMPONENT is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${UI_PACKCOMPONENT})
  set (CPACK_PACKAGE_NAME ${UI_PACKCOMPONENT})
  set (CPACK_COMPONENT_${UI_PACKCOMPONENT}_DISPLAY_NAME "${UI_PACKCOMPONENT}")
  set (CPACK_COMPONENT_${UI_PACKCOMPONENT}_DESCRIPTION "${UI_PACKCOMPONENT}")  
  set (CPACK_NSIS_DISPLAY_NAME "${UI_PACKCOMPONENT}")
  set (CPACK_NSIS_PACKAGE_NAME "${UI_PACKCOMPONENT}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -UI_PACK=COMPONENT_1COMPONENT=COMPONENT_1 ../
nmake package
cmake -UI_PACK=COMPONENT_2COMPONENT=COMPONENT_2 ../
nmake package
...
cmake -UI_PACK=COMPONENT_XCOMPONENT=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested UI_PACKCOMPONENT(aka COMPONENT)

One could provide a CMake attribute e.g. UI_PACK which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the UI_PACK is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${UI_PACK})
  set (CPACK_PACKAGE_NAME ${UI_PACK})
  set (CPACK_COMPONENT_${UI_PACK}_DISPLAY_NAME "${UI_PACK}")
  set (CPACK_COMPONENT_${UI_PACK}_DESCRIPTION "${UI_PACK}")  
  set (CPACK_NSIS_DISPLAY_NAME "${UI_PACK}")
  set (CPACK_NSIS_PACKAGE_NAME "${UI_PACK}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -UI_PACK=COMPONENT_1 ../
nmake package
cmake -UI_PACK=COMPONENT_2 ../
nmake package
...
cmake -UI_PACK=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested UI_PACK(aka COMPONENT)

One could provide a CMake attribute e.g. COMPONENT which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the COMPONENT is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${COMPONENT})
  set (CPACK_PACKAGE_NAME ${COMPONENT})
  set (CPACK_COMPONENT_${COMPONENT}_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_COMPONENT_${COMPONENT}_DESCRIPTION "${COMPONENT}")  
  set (CPACK_NSIS_DISPLAY_NAME "${COMPONENT}")
  set (CPACK_NSIS_PACKAGE_NAME "${COMPONENT}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -COMPONENT=COMPONENT_1 ../
nmake package
cmake -COMPONENT=COMPONENT_2 ../
nmake package
...
cmake -COMPONENT=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested COMPONENT(aka COMPONENT)

Source Link
Met
  • 3.2k
  • 4
  • 27
  • 43

One could provide a CMake attribute e.g. UI_PACK which can be set to a value from a predefined set of package names like: COMPONENT_1|COMPONENT_2|...COMPONENT_X

The package name could even be a name that does not correspond to a single component name but a set of components that would be added in the CPACK_COMPONENTS_ALL. If the UI_PACK is equal to ALL_COMPONENTS then the value of CPACK_COMPONENTS_ALL would contain all possible components.

The cmake packaging:

if (WIN32)
  set (CPACK_COMPONENTS_ALL ${UI_PACK})
  set (CPACK_PACKAGE_NAME ${UI_PACK})
  set (CPACK_COMPONENT_${UI_PACK}_DISPLAY_NAME "${UI_PACK}")
  set (CPACK_COMPONENT_${UI_PACK}_DESCRIPTION "${UI_PACK}")  
  set (CPACK_NSIS_DISPLAY_NAME "${UI_PACK}")
  set (CPACK_NSIS_PACKAGE_NAME "${UI_PACK}")
  set (CPACK_NSIS_INSTALL_ROOT "C:")
  set (CPACK_GENERATOR NSIS)
else()
  ...
endif()

To create an installer for each COMPONENT you would run for example:

cmake -UI_PACK=COMPONENT_1 ../
nmake package
cmake -UI_PACK=COMPONENT_2 ../
nmake package
...
cmake -UI_PACK=COMPONENT_X ../
nmake package

Bear in mind that since the binaries are build on the first execution of nmake package, the subsequent calls to cmake and nmake package will only re-configure the packaging and only build the requested UI_PACK(aka COMPONENT)