Skip to content

Honor custom include directories in CMake exports - #369

Open
fhgffy wants to merge 1 commit into
JuliaStrings:masterfrom
fhgffy:fix/cmake-custom-includedir
Open

fhgffy wants to merge 1 commit into
JuliaStrings:masterfrom
fhgffy:fix/cmake-custom-includedir

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 5, 2026

Copy link
Copy Markdown

Problem

CMAKE_INSTALL_INCLUDEDIR controls where utf8proc.h is installed, but the exported utf8proc::utf8proc target always advertises <prefix>/include. Setting the directory to headers therefore produces an installation that the existing test/app consumer cannot use.

On current master (4bfe012), this reproduces with:

cmake -S . -B build -DCMAKE_INSTALL_INCLUDEDIR=headers \
  -DCMAKE_INSTALL_PREFIX="$PWD/prefix"
cmake --build build
cmake --install build
cmake -S test/app -B consumer -DCMAKE_PREFIX_PATH="$PWD/prefix"

The last command fails because the imported target references the nonexistent prefix/include directory. Both static and shared builds are affected.

Changes

  • Initialize GNUInstallDirs before defining the target's include interface and use ${CMAKE_INSTALL_INCLUDEDIR} in INSTALL_INTERFACE
  • Extend the existing CMake installed-consumer CI matrix with default include and custom headers layouts, keeping artifact names unique

Validation

Tested on Linux with GCC 14.2.0 and CMake 3.31.6:

  • Reproduced the consumer failure on the unmodified base for static and shared custom-directory installs; default-directory controls pass
  • Fixed static/shared × default/custom installs configure, build, link, and run, including after moving each installation prefix
  • All 10 upstream CTests pass in each of the four configurations on both base and fixed trees (40 executions per tree), with Unicode 18.0.0 conformance data
  • Nested relative paths, paths containing spaces, absolute include paths, and add_subdirectory with UTF8PROC_INSTALL=OFF pass
  • Workflow YAML parsing and patch whitespace checks pass

Windows, macOS, MinGW, and the minimum supported CMake 3.10 were not run locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant