Commits (1)
......@@ -57,39 +57,39 @@ macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
endif()
endforeach()
set (${_prefix}_LIBRARIES "${${_prefix}_LIBRARIES}" CACHE INTERNAL "" FORCE)
# static case
set(${_prefix}_STATIC_LIBRARIES_COPY "${${_prefix}_STATIC_LIBRARIES}")
set(${_prefix}_STATIC_LIBRARIES "")
foreach(_library ${${_prefix}_STATIC_LIBRARIES_COPY})
if(EXISTS "${_library}")
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library})
else()
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try static first
set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
# if not found try dynamic
if (NOT _library_path)
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
endif()
if (_library_path)
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
set (${_prefix}_STATIC_LIBRARIES "${${_prefix}_STATIC_LIBRARIES}" CACHE INTERNAL "" FORCE)
## static case
#set(${_prefix}_STATIC_LIBRARIES_COPY "${${_prefix}_STATIC_LIBRARIES}")
#set(${_prefix}_STATIC_LIBRARIES "")
#foreach(_library ${${_prefix}_STATIC_LIBRARIES_COPY})
# if(EXISTS "${_library}")
# list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library})
# else()
# get_filename_component(_ext "${_library}" EXT)
# set(_lib_extensions ".so" ".a" ".dyld" ".dll")
# list(FIND _lib_extensions "${_ext}" _index)
# if (${_index} GREATER -1)
# get_filename_component(_library "${_library}" NAME_WE)
# endif()
# # try static first
# set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
# set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
# find_library(_library_path NAMES ${_library}
# HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
# set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
# # if not found try dynamic
# if (NOT _library_path)
# find_library(_library_path NAMES ${_library}
# HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
# endif()
# if (_library_path)
# list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
# else()
# message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
# endif()
# unset(_library_path CACHE)
# endif()
#endforeach()
#set (${_prefix}_STATIC_LIBRARIES "${${_prefix}_STATIC_LIBRARIES}" CACHE INTERNAL "" FORCE)
endmacro()
##
......