aboutsummaryrefslogtreecommitdiff
path: root/cmake/PkgConfigWithFallback.cmake
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-04-23 10:01:40 +0200
committerMarvin W <git@larma.de>2017-04-26 21:48:53 +0200
commiteddf17c68274c3e8ecf86a13858243159ffe9714 (patch)
treedb92b3ea3ffd453a16df9e53d0b454d172b8c8f2 /cmake/PkgConfigWithFallback.cmake
parent3eb9aa0fa79ea9fcebb5f702f81c2e54aafdc8cc (diff)
downloaddino-eddf17c68274c3e8ecf86a13858243159ffe9714.tar.gz
dino-eddf17c68274c3e8ecf86a13858243159ffe9714.zip
cmake/signal-protocol: shared lib, mark_as_advanced and others
Diffstat (limited to 'cmake/PkgConfigWithFallback.cmake')
-rw-r--r--cmake/PkgConfigWithFallback.cmake31
1 files changed, 17 insertions, 14 deletions
diff --git a/cmake/PkgConfigWithFallback.cmake b/cmake/PkgConfigWithFallback.cmake
index 988e4564..ea14fa23 100644
--- a/cmake/PkgConfigWithFallback.cmake
+++ b/cmake/PkgConfigWithFallback.cmake
@@ -15,15 +15,16 @@ function(find_pkg_config_with_fallback name)
# Try to find real file name of libraries
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
- find_library(LIB_NAME_${lib} ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
- if(NOT LIB_NAME_${lib})
+ find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
+ mark_as_advanced(${name}_${lib}_LIBRARY)
+ if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND)
- endif(NOT LIB_NAME_${lib})
+ endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib)
if(${name}_FOUND)
set(${name}_LIBRARIES "")
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
- list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY})
endforeach(lib)
list(REMOVE_DUPLICATES ${name}_LIBRARIES)
set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
@@ -46,34 +47,36 @@ function(find_pkg_config_with_fallback name)
# No success with pkg-config, try via find_library on all lib_names
set(${name}_FOUND "1")
foreach(lib ${ARGS_LIB_NAMES})
- find_library(LIB_NAME_${lib} ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS})
+ find_library(${name}_${lib}_LIBRARY ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS})
+ mark_as_advanced(${name}_${lib}_LIBRARY)
- if(NOT LIB_NAME_${lib})
+ if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND)
- endif(NOT LIB_NAME_${lib})
+ endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib)
foreach(inc ${ARGS_INCLUDE_NAMES})
- find_path(INCLUDE_PATH_${inc} ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES})
+ find_path(${name}_${inc}_INCLUDE_PATH ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES})
+ mark_as_advanced(${name}_${inc}_INCLUDE_PATH)
- if(NOT INCLUDE_PATH_${inc})
+ if(NOT ${name}_${inc}_INCLUDE_PATH)
unset(${name}_FOUND)
- endif(NOT INCLUDE_PATH_${inc})
+ endif(NOT ${name}_${inc}_INCLUDE_PATH)
endforeach(inc)
if(${name}_FOUND)
set(${name}_LIBRARIES "")
set(${name}_INCLUDE_DIRS "")
foreach(lib ${ARGS_LIB_NAMES})
- list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY})
endforeach(lib)
foreach(inc ${ARGS_INCLUDE_NAMES})
- list(APPEND ${name}_INCLUDE_DIRS ${INCLUDE_PATH_${inc}})
+ list(APPEND ${name}_INCLUDE_DIRS ${${name}_${inc}_INCLUDE_PATH})
endforeach(inc)
list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
foreach(dep ${ARGS_DEPENDS})
- find_package(${dep} QUIET)
+ find_package(${dep} ${${dep}_GLOBAL_VERSION} QUIET)
if(${dep}_FOUND)
list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
@@ -96,4 +99,4 @@ function(find_pkg_config_with_fallback name)
endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
endif(${name}_FOUND)
endif(${name}_PKG_CONFIG_FOUND)
-endfunction() \ No newline at end of file
+endfunction()