Skip to content

CMake: Absolute package configuration install path #2307

@ethanmusser

Description

@ethanmusser

Description

The package configuration install path is absolute. While configuring with CMAKE_INSTALL_PREFIX works, this means that the more-current CMake install syntax does not work. E.g., the following command will install headers, libraries, and exported CMake targets to the install/ directory, but the package configuration files will end up in /usr/local.

cmake --install build/ --prefix install/

Steps to reproduce

  1. Configure without setting CMAKE_INSTALL_PREFIX and build.
    cmake -S . -B build && cmake --build build
  2. Install using the newer syntax.
    cmake --install build/ --prefix install
  3. Examine the contents of install/ (which will contain the headers, libraries, and exported targets) and /usr/local (which will contain the package configuration files).

Expected behavior

All installed artifacts should end up under the specified install prefix.

Environment

OS: Ubuntu 24.04
CMake: 3.28.3

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions