diff --git a/cmake/thread_system_install.cmake b/cmake/thread_system_install.cmake index c401c1943c..209763e43e 100644 --- a/cmake/thread_system_install.cmake +++ b/cmake/thread_system_install.cmake @@ -12,49 +12,48 @@ include(CMakePackageConfigHelpers) # Install headers ################################################## function(install_thread_system_headers) - # Install headers from new structure + # Canonical headers. The whole public API lives under + # include/kcenon/thread/... in the current layout, so a single recursive + # rule installs every header (core, interfaces, utils, lockfree, + # implementation details, etc.) to /include/kcenon/thread/... + # *.tpp template implementation files are installed alongside the headers + # they back (e.g. typed_thread_pool), which the previous per-component + # rules only handled for one module. install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Development - FILES_MATCHING PATTERN "*.h") - - # Install legacy interfaces for backward compatibility - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/interfaces) - install(DIRECTORY interfaces/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_system/interfaces - COMPONENT Development - FILES_MATCHING PATTERN "*.h") - endif() - - # Utility headers - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/utilities/include) - install(DIRECTORY utilities/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_system/utilities - COMPONENT Development - FILES_MATCHING PATTERN "*.h") - endif() - - # Implementation headers - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/implementations/thread_pool/include) - install(DIRECTORY implementations/thread_pool/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_system/implementations/thread_pool - COMPONENT Implementation - FILES_MATCHING PATTERN "*.h") - endif() - - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/implementations/typed_thread_pool/include) - install(DIRECTORY implementations/typed_thread_pool/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_system/implementations/typed_thread_pool - COMPONENT Implementation - FILES_MATCHING PATTERN "*.h" PATTERN "*.tpp") - endif() - - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/implementations/lockfree/include) - install(DIRECTORY implementations/lockfree/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_system/implementations/lockfree - COMPONENT Implementation - FILES_MATCHING PATTERN "*.h") - endif() + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + PATTERN "*.tpp") + + # Legacy forwarding-stub headers (EPIC #683 deprecation window). These are + # thin shims such as core/base/include/thread_base.h that #include the + # canonical header, kept so that downstream code using + # the old flat include names keeps compiling for one release. They are + # installed flat into /include so that #include "thread_base.h" + # style usage still resolves. Each rule is guarded by EXISTS so it becomes + # a no-op once the stubs are removed. + # + # NOTE: the previously referenced interfaces/ and + # implementations/{thread_pool,typed_thread_pool,lockfree}/include/ + # directories do not exist in this tree. Those dangling install(DIRECTORY) + # entries are removed here because their canonical headers are already + # covered by the include/ rule above; leaving them broke the audit of the + # install/export surface (issue #696). + foreach(_legacy_inc + core/base/include + core/sync/include + utilities/include) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_legacy_inc}) + install(DIRECTORY ${_legacy_inc}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT Development + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp") + endif() + endforeach() message(STATUS "Configured header installation") endfunction() diff --git a/cmake/thread_system_targets.cmake b/cmake/thread_system_targets.cmake index cd8c9683ca..ce5e00c552 100644 --- a/cmake/thread_system_targets.cmake +++ b/cmake/thread_system_targets.cmake @@ -52,7 +52,16 @@ function(create_thread_system_targets) # tests) that still link against the legacy target names. The forwarding # header stubs in utilities/include/ and core/{sync,base}/include/ remain # in place for one release per the EPIC #683 deprecation policy. + # thread_pool / typed_thread_pool are included because in-tree tests and + # examples link against those names while only thread_base/utilities/ + # interfaces were aliased before, so a clean configure with tests enabled + # failed with "target thread_pool not found". The installed package already + # exposes thread_system::thread_pool and thread_system::typed_thread_pool via + # thread_system-config.cmake.in, so these aliases make the in-tree target + # graph match the exported one (issue #696). add_library(thread_base ALIAS thread_system) + add_library(thread_pool ALIAS thread_system) + add_library(typed_thread_pool ALIAS thread_system) add_library(utilities ALIAS thread_system) add_library(interfaces ALIAS thread_system) @@ -72,7 +81,7 @@ function(create_thread_system_targets) message(STATUS "thread_system: simdutf support enabled") endif() - message(STATUS "Created thread_system library target with legacy aliases (thread_base, utilities, interfaces)") + message(STATUS "Created thread_system library target with legacy aliases (thread_base, thread_pool, typed_thread_pool, utilities, interfaces)") endfunction() ##################################################