summaryrefslogtreecommitdiffstats
path: root/graphics/kamera-kde4/files/patch-git_1b10fdf
blob: a2b81bb61334f462a7e9e3b8b386e075437bbeb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
commit 1b10fdfc22646ea08683a881648989ef16d61dd1
Author: Raphael Kubo da Costa <rakuco@FreeBSD.org>
Date:   Mon Jan 20 14:16:47 2014 +0200

    cmake: Correctly check for gp_port_info_get_name.
    
    CHECK_LIBRARY_EXISTS() is the wrong function to call here; we've already
    looked for gphoto's librares in FindGphoto2.cmake. Instead, we are
    interested in knowing whether the symbol gp_port_info_get_name is present in
    the libraries, since this indicates we have gphoto >= 2.5.0.
    
    Additionally, we must also set CMAKE_REQUIRED_{INCLUDES,LIBRARIES} to take
    into account the gphoto header and library paths we have found, otherwise
    we're just relying on them being in the compiler/linker's default paths.
    
    While here, also set HAVE_GPHOTO2_5 directly instead of setting GPHOTO2_5
    and then using its value to set the former.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebae998..08d3b0e 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -1,25 +1,28 @@
 project(kamera)
 
 find_package(KDE4 REQUIRED)
+include(CMakePushCheckState)
+include(CheckSymbolExists)
 include(KDE4Defaults)
 include(MacroLibrary)
 include(MacroOptionalAddSubdirectory)
-
 
 find_package(Gphoto2)
 macro_log_feature(GPHOTO2_FOUND "gphoto2" "Required to build kamera" "http://heanet.dl.sourceforge.net/sourceforge/gphoto" TRUE "" "")
 
-check_library_exists(gphoto2_port gp_port_info_get_name "" GPHOTO2_5)
-if(GPHOTO2_5)
-    message(STATUS "Found libgphoto 2.5")
-else(GPHOTO2_5)
-    message(STATUS "libgphoto 2.5 not found, assuming libgphoto2 2.4")
-endif(GPHOTO2_5)
-set(HAVE_GPHOTO2_5 ${GPHOTO2_5})
-
-include(ConfigureChecks.cmake)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_INCLUDES "${GPHOTO2_INCLUDE_DIR}")
+set(CMAKE_REQUIRED_LIBRARIES "${GPHOTO2_LIBRARIES}")
+check_symbol_exists(gp_port_info_get_name "gphoto2.h" HAVE_GPHOTO2_5)
+cmake_pop_check_state()
 
+if(HAVE_GPHOTO2_5)
+    message(STATUS "Detected libgphoto 2.5.0 or newer")
+else()
+    message(STATUS "Detected libgphoto2 2.4 or older")
+endif()
 
+include(ConfigureChecks.cmake)
 
 configure_file(config-kamera.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kamera.h)
 
OpenPOWER on IntegriCloud