From 07d4142a18c889c03b499e6db73f915e1d724d96 Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Sun, 19 Apr 2015 22:51:31 +0300 Subject: CMake: Refer to Unibilium instead of LibUnibilium. --- cmake/FindUnibilium.cmake | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cmake/FindUnibilium.cmake (limited to 'cmake/FindUnibilium.cmake') diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake new file mode 100644 index 0000000000..3cb7dacef8 --- /dev/null +++ b/cmake/FindUnibilium.cmake @@ -0,0 +1,48 @@ +# - Try to find unibilium +# Once done this will define +# UNIBILIUM_FOUND - System has unibilium +# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories +# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium + +find_package(PkgConfig) +if(NOT UNIBILIUM_USE_BUNDLED) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_UNIBILIUM QUIET unibilium) + endif() +else() + set(PC_UNIBILIUM_INCLUDEDIR) + set(PC_UNIBILIUM_INCLUDE_DIRS) + set(PC_UNIBILIUM_LIBDIR) + set(PC_UNIBILIUM_LIBRARY_DIRS) + set(LIMIT_SEARCH NO_DEFAULT_PATH) +endif() + +set(UNIBILIUM_DEFINITIONS ${PC_UNIBILIUM_CFLAGS_OTHER}) + +find_path(UNIBILIUM_INCLUDE_DIR unibilium.h + PATHS ${PC_UNIBILIUM_INCLUDEDIR} ${PC_UNIBILIUM_INCLUDE_DIRS} + ${LIMIT_SEARCH}) + +# If we're asked to use static linkage, add libunibilium.a as a preferred library name. +if(UNIBILIUM_USE_STATIC) + list(APPEND UNIBILIUM_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() + +list(APPEND UNIBILIUM_NAMES unibilium) + +find_library(UNIBILIUM_LIBRARY NAMES ${UNIBILIUM_NAMES} + HINTS ${PC_UNIBILIUM_LIBDIR} ${PC_UNIBILIUM_LIBRARY_DIRS} + ${LIMIT_SEARCH}) + +set(UNIBILIUM_LIBRARIES ${UNIBILIUM_LIBRARY}) +set(UNIBILIUM_INCLUDE_DIRS ${UNIBILIUM_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set UNIBILIUM_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(unibilium DEFAULT_MSG + UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR) + +mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) -- cgit From 2446b997c63b8a2aa75493f546918cb69c6a4111 Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Mon, 20 Apr 2015 01:02:41 +0300 Subject: CMake: Remove duplicate PkgConfig lookups. --- cmake/FindUnibilium.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'cmake/FindUnibilium.cmake') diff --git a/cmake/FindUnibilium.cmake b/cmake/FindUnibilium.cmake index 3cb7dacef8..e1e0de9b7e 100644 --- a/cmake/FindUnibilium.cmake +++ b/cmake/FindUnibilium.cmake @@ -4,7 +4,6 @@ # UNIBILIUM_INCLUDE_DIRS - The unibilium include directories # UNIBILIUM_LIBRARIES - The libraries needed to use unibilium -find_package(PkgConfig) if(NOT UNIBILIUM_USE_BUNDLED) find_package(PkgConfig) if (PKG_CONFIG_FOUND) -- cgit