diff options
Diffstat (limited to 'cmake/opentrack-pkg-config.cmake')
-rw-r--r-- | cmake/opentrack-pkg-config.cmake | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake index 7d70070e..5b84cf40 100644 --- a/cmake/opentrack-pkg-config.cmake +++ b/cmake/opentrack-pkg-config.cmake @@ -2,26 +2,18 @@ include_guard(GLOBAL) include(FindPkgConfig) function(otr_pkgconfig target) - set(cflags "") - set(includes "") - set(ldflags "") - set(libs "") foreach(i ${ARGN}) set(k pkg-config_${i}) pkg_check_modules(${k} QUIET ${i}) if(${${k}_FOUND}) - set(cflags "${cflags} ${${k}_CFLAGS} ") - set(includes ${includes} ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR}) - set(ldflags "${ldflags} ${${k}_LDFLAGS} ") - set(libs ${libs} ${${k}_LIBRARIES}) + 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() - set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "${cflags} ") - target_include_directories(${target} SYSTEM PRIVATE ${includes}) - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "${ldflags} ") - target_link_libraries(${target} ${libs}) endfunction() |