CMake: package the viewer component in JFJOCH_VIEWER_ONLY builds

A viewer-only build builds jfjoch_viewer but the CPack block hard-coded
CPACK_COMPONENTS_ALL to "jfjoch writer" and only appended "viewer" when
JFJOCH_VIEWER_BUILD was set -- which a pure viewer-only build does not set.
cpack then tried to package the empty jfjoch/writer components and failed,
requiring a manual -D CPACK_COMPONENTS_ALL=viewer.

Branch the component list on build mode: viewer-only packages just "viewer";
other modes keep "jfjoch writer" plus driver-dkms/viewer when their flags are
set. Also drops the redundant re-set of the default list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 16:13:24 +02:00
co-authored by Claude Opus 4.8
parent 5064b5ba47
commit 5247acc07e
+9 -10
View File
@@ -319,20 +319,19 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Set Package Name
# Initialize CPACK_COMPONENTS_ALL with common components
set(CPACK_COMPONENTS_ALL jfjoch writer)
SET(CPACK_PACKAGE_NAME "jfjoch")
# Add optional components
if (JFJOCH_INSTALL_DRIVER_SOURCE)
list(APPEND CPACK_COMPONENTS_ALL driver-dkms)
# Select the components to package based on build mode
if (JFJOCH_VIEWER_ONLY)
set(CPACK_COMPONENTS_ALL viewer)
else()
set(CPACK_COMPONENTS_ALL jfjoch writer)
endif()
if (JFJOCH_VIEWER_BUILD)
list(APPEND CPACK_COMPONENTS_ALL viewer)
if (JFJOCH_INSTALL_DRIVER_SOURCE)
list(APPEND CPACK_COMPONENTS_ALL driver-dkms)
endif()
if (JFJOCH_VIEWER_BUILD)
list(APPEND CPACK_COMPONENTS_ALL viewer)
endif()
endif()
# Common metadata