aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2022-11-03 09:46:07 -0600
committerfiaxh <git@lightrise.org>2022-11-03 14:10:57 -0600
commit6e37f3fe3fa0f4ce9a25a91e9d97191c8e4abec1 (patch)
tree82ab76feb349dceccdfe3e362f211ca3cff7c10e /cmake
parent809c1579e41000f2f43eeb05735afc8165a1a430 (diff)
downloaddino-6e37f3fe3fa0f4ce9a25a91e9d97191c8e4abec1.tar.gz
dino-6e37f3fe3fa0f4ce9a25a91e9d97191c8e4abec1.zip
Automatically select appropriate libsoup version
Diffstat (limited to 'cmake')
-rw-r--r--cmake/MultiFind.cmake2
-rw-r--r--cmake/SoupVersion.cmake33
2 files changed, 35 insertions, 0 deletions
diff --git a/cmake/MultiFind.cmake b/cmake/MultiFind.cmake
index b40a4677..3400a9bc 100644
--- a/cmake/MultiFind.cmake
+++ b/cmake/MultiFind.cmake
@@ -20,6 +20,7 @@ function(find_packages result)
find_package(${pkg} ${pkg_version} REQUIRED)
list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ set(${pkg}_VERSION "${${pkg}_VERSION}" PARENT_SCOPE)
endforeach(pkg)
foreach(pkg ${ARGS_OPTIONAL})
string(REPLACE ">=" ";" pkg_ ${pkg})
@@ -38,6 +39,7 @@ function(find_packages result)
if(${pkg}_FOUND)
list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ set(${pkg}_VERSION "${${pkg}_VERSION}" PARENT_SCOPE)
endif()
endforeach(pkg)
set(${result} "${_res}" PARENT_SCOPE)
diff --git a/cmake/SoupVersion.cmake b/cmake/SoupVersion.cmake
new file mode 100644
index 00000000..625a1513
--- /dev/null
+++ b/cmake/SoupVersion.cmake
@@ -0,0 +1,33 @@
+find_package(Nice QUIET)
+if (Nice_FOUND AND NOT SOUP_VERSION AND NOT USE_SOUP3)
+ file(GET_RUNTIME_DEPENDENCIES
+ RESOLVED_DEPENDENCIES_VAR Nice_DEPENDENCIES
+ UNRESOLVED_DEPENDENCIES_VAR Nice_UNRESOLVED_DEPENDENCIES
+ LIBRARIES ${Nice_LIBRARY}
+ PRE_INCLUDE_REGEXES "soup|gupnp"
+ PRE_EXCLUDE_REGEXES "."
+ )
+ foreach (lib ${Nice_DEPENDENCIES})
+ if (lib MATCHES ".*/libsoup-3.*")
+ set(SOUP_VERSION 3)
+ endif ()
+ endforeach ()
+ foreach (lib ${Nice_DEPENDENCIES})
+ if (lib MATCHES ".*/libsoup-2.*")
+ set(SOUP_VERSION 2)
+ endif ()
+ endforeach ()
+ set(SOUP_VERSION ${SOUP_VERSION} CACHE STRING "Version of libsoup to use")
+ set_property(CACHE SOUP_VERSION PROPERTY STRINGS "2" "3")
+ message(STATUS "Using Soup${SOUP_VERSION} to provide Soup")
+elseif (NOT SOUP_VERSION)
+ find_package(Soup2 QUIET)
+ find_package(Soup3 QUIET)
+ # Only use libsoup 3 if specifically requested or when libsoup 2 is not available
+ if (Soup3_FOUND AND NOT Soup2_FOUND OR USE_SOUP3)
+ set(SOUP_VERSION 3)
+ else ()
+ set(SOUP_VERSION 2)
+ endif ()
+endif ()
+set(Soup "Soup${SOUP_VERSION}") \ No newline at end of file