diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-07-06 17:16:58 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-07-06 17:34:18 +0200 |
commit | 9d5219724d4eddf1e96a4e4a421f645069dd504a (patch) | |
tree | 6f8fb8885568a02cbe943bb2324629d0c959bb7c /cmake | |
parent | 6e0e64ff0ee254d2300ded97ad805582aaac1905 (diff) |
cmake: support optional pkg-config deps
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-pkg-config.cmake | 14 |
1 files changed, 13 insertions, 1 deletions
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() |