Skip to content

GNUInstallDirs: Regression in multiarch LIBDIR application

Consider the following example:

cmake_minimum_required(VERSION 3.22)
project(test)

include(GNUInstallDirs)
add_library(example SHARED ex.cpp)
install(TARGETS example)

When configured, built and installed like this:

cmake -S <src> -B <build> -DCMAKE_INSTALL_PREFIX=/home/<user>/install && cmake --build build && cmake --install build 

We get the following install location for example: /home/rmaynard/install/lib/libexample.so

But when we configure like so, we incorrectly cache the multi-arch value from the initial pass:

cmake -S <src> -B <build> && cmake -S <src> -B <build> -DCMAKE_INSTALL_PREFIX=/home/<user>/install && cmake --build build && cmake --install build 

And get the wrong install location for example: /home/rmaynard/install/lib/x86_64-linux-gnu/libexample.so

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information