The coverage target is not namespaced when embedded, so an embedding consumer cannot configure #15

Open
opened 2026-08-02 18:59:16 -04:00 by tachikoma · 0 comments
Collaborator

Source: found downstream: libakstdlib TODO.md §1.3, filed here while moving both trackers (at 5695061)

Recorded only in a consumer's TODO file, never in this repository's.

CMakeLists.txt:281 declares add_custom_target(coverage ...) unconditionally,
while the mutation target twenty lines below is guarded:

281:    add_custom_target(coverage
298:    if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
301:        set(AKERR_MUTATION_TARGET akerror_mutation)

Consequence downstream. A -DAKSL_COVERAGE=ON top-level build of libakstdlib
fails to configure at all -- "another target with the same name already
exists"
-- and libakstdlib/CMakeLists.txt shadows add_custom_target for the
duration of the add_subdirectory() call to rename this library's target to
akerror_coverage.

A consumer should not have to shadow a CMake command to embed a dependency.

Fix: apply the same CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR test
the mutation target already has; then the shadow downstream comes out.

Files: CMakeLists.txt:281


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** found downstream: libakstdlib TODO.md §1.3, filed here while moving both trackers (at 5695061) **Recorded only in a consumer's TODO file, never in this repository's.** `CMakeLists.txt:281` declares `add_custom_target(coverage ...)` unconditionally, while the `mutation` target twenty lines below **is** guarded: ```cmake 281: add_custom_target(coverage 298: if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 301: set(AKERR_MUTATION_TARGET akerror_mutation) ``` **Consequence downstream.** A `-DAKSL_COVERAGE=ON` top-level build of libakstdlib **fails to configure at all** -- *"another target with the same name already exists"* -- and `libakstdlib/CMakeLists.txt` shadows `add_custom_target` for the duration of the `add_subdirectory()` call to rename this library's target to `akerror_coverage`. **A consumer should not have to shadow a CMake command to embed a dependency.** **Fix:** apply the same `CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR` test the `mutation` target already has; then the shadow downstream comes out. **Files:** `CMakeLists.txt:281` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 2.0.x milestone 2026-08-02 18:59:16 -04:00
tachikoma added the packagingblast-radius:mediumstatus::grooming labels 2026-08-02 18:59:16 -04:00
Sign in to join this conversation.