jgarff / rpi_ws281x

Userspace Raspberry Pi PWM library for WS281X LEDs
BSD 2-Clause "Simplified" License
1.76k stars 616 forks source link

CMake INSTALL cannot find libws2811.pc when repo is built with FetchContent #448

Open arcturis opened 3 years ago

arcturis commented 3 years ago

When using CMake's FetchContent to pull the rpi_ws281x repo as a dependency, the make install step fails with the message:

CMake Error at build/rpi_ws281x_src/cmake_install.cmake:78 (file):
  file INSTALL cannot find
  "/path/to/project/build/libws2811.pc":
  No such file or directory.
Call Stack (most recent call first):
  cmake_install.cmake:47 (include)

Steps to reproduce:

Make a CMakeLists.txt file containing:

cmake_minimum_required(VERSION 3.11)

project(test_fetch_install)

include(FetchContent)

FetchContent_Populate(
    rpi_ws281x
    GIT_REPOSITORY https://github.com/jgarff/rpi_ws281x.git
    SOURCE_DIR rpi_ws281x_src
)

add_subdirectory(${rpi_ws281x_SOURCE_DIR})

Run the commands:

mkdir build && cd build
cmake -DBUILD_SHARED=ON ..
make install

I am using cmake version 3.19.5 on Ubuntu 18.04.5 LTS.