fix finding the lensfun library for the LENSFUN_HAS_LOAD_DIRECTORY test

This commit is contained in:
Alberto Griggio 2017-09-18 09:00:48 +02:00
parent a4ecae03b5
commit 33867a4bf2

View File

@ -450,7 +450,17 @@ include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${LENSFUN_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES)
foreach(l ${LENSFUN_LIBRARIES})
if(LENSFUN_LIBRARY_DIRS)
# the NO_DEFAULT_PATH is to make sure we find the lensfun version we
# want, and not the system's one (e.g. if we have a custom version
# installed in a non-standard location)
find_library(_l ${l} PATHS ${LENSFUN_LIBRARY_DIRS} NO_DEFAULT_PATH)
else()
# LENSFUN_LIBRARY_DIRS can be empty if lensfun is installed in the
# default path. In this case, adding NO_DEFAULT_PATH would make
# find_library fail...
find_library(_l ${l})
endif()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${_l})
endforeach()
check_cxx_source_compiles(