summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-05-27 06:20:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-05-27 06:22:04 +0200
commit75501dca9304c9ca691cc20aafc647d721c17218 (patch)
tree23c3f2799583b6d10605c2785f262baf10bf8d5c
parenta8ad3077437e954ab65ba472ea11a4bacd86b8f9 (diff)
cmake: add pkgconfig for Linux
-rw-r--r--cmake/opentrack-pkg-config.cmake22
-rw-r--r--cmake/opentrack-platform.cmake2
2 files changed, 23 insertions, 1 deletions
diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake
new file mode 100644
index 00000000..e9136563
--- /dev/null
+++ b/cmake/opentrack-pkg-config.cmake
@@ -0,0 +1,22 @@
+include(FindPkgConfig)
+
+function(otr_pkgconfig target)
+ set(cflags "")
+ set(includes "")
+ set(ldflags "")
+ foreach(i ${ARGN})
+ set(k pkg-config_${i})
+ pkg_check_modules(${k} REQUIRED QUIET ${i})
+ if(${${k}_FOUND})
+ set(cflags "${cflags} ${${k}_CFLAGS} ")
+ set(includes ${includes} ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR})
+ set(ldflags "${ldflags} ${${k}_LDFLAGS} ")
+ endif()
+ endforeach()
+ #message(STATUS "foo | ${cflags} | ${includes} | ${ldflags}")
+ 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}")
+endfunction()
+
+
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index f54e4112..1141eac8 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -156,5 +156,5 @@ if(MINGW)
endif()
if(UNIX AND NOT APPLE)
- include(FindPkgConfig)
+ include(opentrack-pkg-config)
endif()