FindConfig.cmake 686 B

1234567891011121314151617181920212223242526272829
  1. # CONFIG_FOUND
  2. # CONFIG_LIBRARIES
  3. # CONFIG_LIBRARY_DIRS
  4. # CONFIG_LDFLAGS
  5. # CONFIG_INCLUDE_DIRS
  6. # CONFIG_CFLAGS
  7. if (NOT KS_PLAT_WIN)
  8. include(FindPkgConfig)
  9. if (NOT PKG_CONFIG_FOUND)
  10. message("Failed to locate pkg-config" FATAL)
  11. endif()
  12. pkg_check_modules(CONFIG libconfig REQUIRED)
  13. link_directories(${CONFIG_LIBRARY_DIRS})
  14. else()
  15. if (NOT TARGET libconfig)
  16. message(FATAL_ERROR "Failed to locate libconfig target")
  17. endif()
  18. set(CONFIG_LIBRARIES "libconfig")
  19. get_target_property(CONFIG_INCLUDE_DIRS libconfig SOURCE_DIR)
  20. set(CONFIG_INCLUDE_DIRS ${CONFIG_INCLUDE_DIRS})
  21. message("CONFIG_INCLUDE_DIRS ${CONFIG_INCLUDE_DIRS}")
  22. set(CONFIG_CFLAGS -DLIBCONFIG_STATIC=1)
  23. endif()