summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-pkg-config.cmake
blob: 5b84cf40217be6693a22b941dce7aaa64c22b0c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
include_guard(GLOBAL)
include(FindPkgConfig)

function(otr_pkgconfig target)
    foreach(i ${ARGN})
        set(k pkg-config_${i})
        pkg_check_modules(${k} QUIET ${i})
        if(${${k}_FOUND})
            target_compile_options(${target} PRIVATE "${${k}_CFLAGS}")
            target_link_options(${target} PRIVATE ${${k}_LDFLAGS})
            target_include_directories(${target} SYSTEM PRIVATE ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR})
            target_link_libraries(${target} ${${k}_LIBRARIES})
        else()
            message(FATAL_ERROR "Can't find '${i}'. Please install development files for this package.")
        endif()
    endforeach()
endfunction()