jgarff / rpi_ws281x

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

Fix CMake install search location for libws2811.pc #449

Closed arcturis closed 3 years ago

arcturis commented 3 years ago

This should fix the issue #448 that I was having.

Tells CMake to look for libws2811.pc in the current binary dir rather than the top level binary dir. This allows make install to find libws2811.pc even when the rpi_ws281x repo has been included as a FetchContent subdirectory in a parent project (see issue #448 ).

I am by no means a CMake expert but this change seemed to make sense according to the documentation, fixes the FetchContent issue and I found no regression in the regular build process.

@flokli I think you wrote the original CMake code for libws2811.pc so including you here, hopefully the fix makes sense!

flokli commented 3 years ago

Do CMAKE_CURRENT_BINARY_DIR and CMAKE_BINARY_DIR differ when building rpi_ws281x independently?

arcturis commented 3 years ago

No, I believe they have the same value when building an independent project, as the top level is the same as the current project in that case. However in the case of using FetchContent, it seems to create sub-directories in the build directory, and that causes the install step to fail as it's expecting libws2811.pc to be in the top level.

Gadgetoid commented 3 years ago

Sounds rational. Thank you!