From 9d5219724d4eddf1e96a4e4a421f645069dd504a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Jul 2023 17:16:58 +0200 Subject: cmake: support optional pkg-config deps --- cmake/opentrack-pkg-config.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake index 5b84cf40..0f13defc 100644 --- a/cmake/opentrack-pkg-config.cmake +++ b/cmake/opentrack-pkg-config.cmake @@ -1,7 +1,8 @@ include_guard(GLOBAL) include(FindPkgConfig) -function(otr_pkgconfig target) +function(otr_pkgconfig_ ret target) + set(${ret} 1 PARENT_SCOPE) foreach(i ${ARGN}) set(k pkg-config_${i}) pkg_check_modules(${k} QUIET ${i}) @@ -11,6 +12,17 @@ function(otr_pkgconfig target) target_include_directories(${target} SYSTEM PRIVATE ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR}) target_link_libraries(${target} ${${k}_LIBRARIES}) else() + set(${ret} 0 PARENT_SCOPE) + endif() + endforeach() +endfunction() + +function(otr_pkgconfig target) + set(ret "") + otr_pkgconfig_(ret "${target}" ${ARGN}) + foreach(i ${ARGN}) + set(k pkg-config_${i}) + if(NOT ${${k}_FOUND}) message(FATAL_ERROR "Can't find '${i}'. Please install development files for this package.") endif() endforeach() -- cgit v1.2.3