Skip to content

Commit 732a054

Browse files
kmilosTurboGit
authored andcommitted
CMake: prioritize pkgconfig for libghpoto2 search
1 parent 393b14c commit 732a054

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cmake/modules/FindGphoto2.cmake

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@
1919

2020
include(LibFindMacros)
2121

22-
find_path(Gphoto2_INCLUDE_DIR gphoto2/gphoto2.h)
23-
mark_as_advanced(Gphoto2_INCLUDE_DIR)
24-
25-
set(Gphoto2_NAMES ${Gphoto2_NAMES} gphoto2 libgphoto2)
26-
set(Gphoto2_PORT_NAMES ${Gphoto2_PORT_NAMES} gphoto2_port libgphoto2_port)
27-
find_library(Gphoto2_LIBRARY NAMES ${Gphoto2_NAMES} )
28-
find_library(Gphoto2_PORT_LIBRARY NAMES ${Gphoto2_PORT_NAMES} )
29-
mark_as_advanced(Gphoto2_LIBRARY)
30-
mark_as_advanced(Gphoto2_PORT_LIBRARY)
31-
3222
# Detect libgphoto2 version
3323
libfind_pkg_check_modules(Gphoto2_PKGCONF libgphoto2)
3424
if(Gphoto2_PKGCONF_FOUND)
@@ -41,10 +31,20 @@ if(Gphoto2_PORT_PKGCONF_FOUND)
4131
set(Gphoto2_PORT_VERSION_STRING "${Gphoto2_PORT_PKGCONF_VERSION}")
4232
endif()
4333

34+
find_path(Gphoto2_INCLUDE_DIR NAMES gphoto2/gphoto2.h HINTS ${Gphoto2_PKGCONF_INCLUDE_DIRS})
35+
mark_as_advanced(Gphoto2_INCLUDE_DIR)
36+
37+
set(Gphoto2_NAMES ${Gphoto2_NAMES} gphoto2 libgphoto2)
38+
set(Gphoto2_PORT_NAMES ${Gphoto2_PORT_NAMES} gphoto2_port libgphoto2_port)
39+
find_library(Gphoto2_LIBRARY NAMES ${Gphoto2_NAMES} HINTS ${Gphoto2_PKGCONF_LIBRARY_DIRS})
40+
find_library(Gphoto2_PORT_LIBRARY NAMES ${Gphoto2_PORT_NAMES} HINTS ${Gphoto2_PORT_PKGCONF_LIBRARY_DIRS})
41+
mark_as_advanced(Gphoto2_LIBRARY)
42+
mark_as_advanced(Gphoto2_PORT_LIBRARY)
43+
4444
# handle the QUIETLY and REQUIRED arguments and set Gphoto2_FOUND to TRUE if
4545
# all listed variables are TRUE
4646
include(FindPackageHandleStandardArgs)
47-
find_package_handle_standard_args(Gphoto2 DEFAULT_MSG Gphoto2_LIBRARY Gphoto2_INCLUDE_DIR)
47+
find_package_handle_standard_args(Gphoto2 DEFAULT_MSG Gphoto2_LIBRARY Gphoto2_PORT_LIBRARY Gphoto2_INCLUDE_DIR)
4848

4949
IF(Gphoto2_FOUND)
5050
SET(Gphoto2_LIBRARIES ${Gphoto2_LIBRARY} ${Gphoto2_PORT_LIBRARY})

0 commit comments

Comments
 (0)