dyne / frei0r

A large collection of free and portable video plugins
https://frei0r.dyne.org/
GNU General Public License v2.0
437 stars 91 forks source link

Add option for location of pkgconfig files #80

Closed Othko97 closed 5 years ago

Othko97 commented 5 years ago

Adds a CMake option for modifying the location of the pkgconfig path in the installation. This defaults to using ${CMAKE_INSTALL_LIBDIR}/pkgconfig if not specified on command line, which seems like a sensible default.

I'm not too familiar with CMake, so I'm unsure if there's a more canonical variable name to set for this kind of configuration, or even a better way to change this configuration.

Addresses #79

ddennedy commented 5 years ago

In case you missed it, I had to revert this because I did not find a quick fix. https://github.com/dyne/frei0r/commit/fe776711dd3523bedc0d5180df68047849b9bc99#commitcomment-33317309

Othko97 commented 5 years ago

Looks like the problem is that using CMAKE_INSTALL_LIBDIR requires the inclusion of the GNUInstallDirs package, and is not, as I thought, a variable in vanilla cmake.

Sorry about this, I missed the installation problems as I did the testing within the build system of freedesktop-sdk, which passes a -DCMAKE_INSTALL_LIBDIR=${libdir} to every call of cmake, and didn't realise this variable isn't defined to a default.

The patch should work with the addition of install(GNUInstallDirs) in CMakeLists.txt, I'll make that change and test it builds properly without passing anything extra to cmake.

ddennedy commented 5 years ago

I verified that include works for me. It's too bad I overlooked this last night in my haste. Also, I found the simple fix to let travis run is to make install with sudo. (sigh)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8466329..38c05a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,4 +49,5 @@ set (exec_prefix "${CMAKE_INSTALL_PREFIX}")
 set (libdir "${CMAKE_INSTALL_PREFIX}/lib")
 set (includedir "${CMAKE_INSTALL_PREFIX}/include")
 configure_file ("frei0r.pc.in" "frei0r.pc" @ONLY)
-install (FILES "${CMAKE_CURRENT_BINARY_DIR}/frei0r.pc" DESTINATION lib/pkgconfig)
+include(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/frei0r.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")