On jeudi 17 février 2022 07:36:10 CET mark_at_yahoo via Rosegarden-devel 
wrote:
> Will do. I had temporarily commented out the code in my working tree
> despite being concerned about what the rg_OPTIONAL_LIB_DIRS are used
> for. But if you're okay with ignoring them for cmake < 3.13.0 builds,
> let's go for it.

It's used to find libjack when linking to it.
But things aren't usually done this way in CMake, which is why 
target_link_directories didn't exist until recently. The "right" way to use 
pkgconfig is to follow it with a find_library call in order to resolve "lib 
name jack in /usr/lib64" (as returned by pkgconfig) into a full path (/usr/
lib64/libjack.so) to link against.

This is done in the attached patch. I have to go see a customer now, feel free 
to make a merge request with this patch if you like it.

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
diff --git i/CMakeLists.txt w/CMakeLists.txt
index 793259b9d..b037eb8bc 100644
--- i/CMakeLists.txt
+++ w/CMakeLists.txt
@@ -166,7 +166,12 @@ pkg_check_modules(SAMPLERATE REQUIRED samplerate>=0.1.2)
 pkg_check_modules(SNDFILE sndfile>=1.0.16)
 add_feature_info(SNDFILE SNDFILE_FOUND "Better support for WAV files")
 
-pkg_check_modules(JACK jack)
+pkg_check_modules(PC_JACK jack)
+# Use find_library to turn it into a full path
+find_library(JACK_LIBRARIES NAMES ${PC_JACK_LIBRARIES} jack PATHS ${PC_JACK_LIBRARY_DIRS})
+if(JACK_LIBRARIES)
+    set(JACK_FOUND TRUE)
+endif()
 if(JACK_FOUND)
     add_feature_info(JACK JACK_FOUND "Library for accessing the JACK server (http://jackaudio.org).")
 else()
diff --git i/src/CMakeLists.txt w/src/CMakeLists.txt
index 21ed9d84a..ba97063f4 100644
--- i/src/CMakeLists.txt
+++ w/src/CMakeLists.txt
@@ -22,7 +22,6 @@ include_directories(
 )
 
 set(rg_OPTIONAL_LIBS )
-set(rg_OPTIONAL_LIB_DIRS )
 
 # For each optional dependency: if found, set a -D definition, a -I include path, and add lib to the list
 if(SNDFILE_FOUND)
@@ -35,7 +34,6 @@ if(JACK_FOUND)
     include_directories(${JACK_INCLUDE_DIRS})
     add_definitions(-DHAVE_LIBJACK)
     set(rg_OPTIONAL_LIBS ${rg_OPTIONAL_LIBS} ${JACK_LIBRARIES})
-    set(rg_OPTIONAL_LIB_DIRS ${rg_OPTIONAL_LIB_DIRS} ${JACK_LIBRARY_DIRS})
 endif()
 
 if(LIRCCLIENT_FOUND)
@@ -873,10 +871,6 @@ target_link_libraries(rosegardenprivate
   ${SAMPLERATE_LIBRARIES}
   ${rg_OPTIONAL_LIBS}
 )
-target_link_directories(rosegardenprivate
-  PUBLIC
-  ${rg_OPTIONAL_LIB_DIRS}
-)
 
 #########################
 # Generate list of source files, as input for buildkey.cmake to compute BUILDKEY at compile time
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to