debian/watch: update version to 4
[libam7xxx.git] / debian / patches / CMakeLists.txt-use-GNUInstallDirs.patch
1 From bf64f1248765470b023d49e311cdcfc4b7b4fc7a Mon Sep 17 00:00:00 2001
2 From: Antonio Ospite <ao2@ao2.it>
3 Date: Fri, 2 Mar 2018 13:40:48 +0100
4 Subject: [PATCH] CMakeLists.txt: use GNUInstallDirs
5 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM<pyWR#k60!#=#>/Vb;]yA5<GWI5`6u&+
6  ;6b'@y|8w"wB;4/e!7wYYrcqdJFY,~%Gk_4]cq$Ei/7<j&N3ah(m`ku?pX.&+~:_/wC~dwn^)MizBG
7  !pE^+iDQQ1yC6^,)YDKkxDd!T>\I~93>J<_`<4)A{':UrE
8
9 This fixes installation in multi-arch paths on systems which supports that.
10 ---
11  CMakeLists.txt          | 2 ++
12  doc/CMakeLists.txt      | 2 +-
13  doc/man/CMakeLists.txt  | 2 +-
14  examples/CMakeLists.txt | 6 +++---
15  src/CMakeLists.txt      | 8 ++++----
16  src/libam7xxx.pc.in     | 6 ++----
17  6 files changed, 13 insertions(+), 13 deletions(-)
18
19 diff --git a/CMakeLists.txt b/CMakeLists.txt
20 index 73657f8..f234866 100644
21 --- a/CMakeLists.txt
22 +++ b/CMakeLists.txt
23 @@ -1,6 +1,8 @@
24  cmake_minimum_required(VERSION 2.6)
25  project(libam7xxx C)
26  
27 +include (GNUInstallDirs)
28 +
29  set(PROJECT_DESCRIPTION
30    "Communication library for Actions Micro AM7XXX based USB projectors and DPFs")
31  
32 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
33 index 6ccf100..0335a2e 100644
34 --- a/doc/CMakeLists.txt
35 +++ b/doc/CMakeLists.txt
36 @@ -17,7 +17,7 @@ if(DOXYGEN_FOUND)
37    install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} doc)")
38  
39    install(DIRECTORY ${DOC_OUTPUT_PATH}/html
40 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}"
41 +    DESTINATION ${CMAKE_INSTALL_DOCDIR}
42      COMPONENT doc)
43  
44  endif(DOXYGEN_FOUND)
45 diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt
46 index c7ce4bb..f97b1cb 100644
47 --- a/doc/man/CMakeLists.txt
48 +++ b/doc/man/CMakeLists.txt
49 @@ -20,7 +20,7 @@ if(ASCIIDOC_FOUND)
50      ${DOC_OUTPUT_PATH}/man/am7xxx-play.1
51      ${DOC_OUTPUT_PATH}/man/am7xxx-modeswitch.1
52      ${DOC_OUTPUT_PATH}/man/picoproj.1
53 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
54 +    DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/"
55      COMPONENT manpages)
56  
57  endif(ASCIIDOC_FOUND)
58 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
59 index d44a26f..f624ba5 100644
60 --- a/examples/CMakeLists.txt
61 +++ b/examples/CMakeLists.txt
62 @@ -9,7 +9,7 @@ if(BUILD_PICOPROJ)
63    add_executable(picoproj picoproj.c)
64    target_link_libraries(picoproj am7xxx)
65    install(TARGETS picoproj
66 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
67 +    DESTINATION ${CMAKE_INSTALL_BINDIR})
68  endif()
69  
70  # Build a more complete example
71 @@ -58,7 +58,7 @@ if(BUILD_AM7XXX-PLAY)
72      ${FFMPEG_LIBSWSCALE_LIBRARIES}
73      ${OPTIONAL_LIBRARIES})
74    install(TARGETS am7xxx-play
75 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
76 +    DESTINATION ${CMAKE_INSTALL_BINDIR})
77  endif()
78  
79  # Build a simple usb-modeswitch clone for am7xxx devices
80 @@ -71,6 +71,6 @@ if(BUILD_am7xxx-modeswitch)
81    add_executable(am7xxx-modeswitch am7xxx-modeswitch.c)
82    target_link_libraries(am7xxx-modeswitch ${LIBUSB_1_LIBRARIES})
83    install(TARGETS am7xxx-modeswitch
84 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
85 +    DESTINATION ${CMAKE_INSTALL_BINDIR})
86  endif()
87  
88 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
89 index d6cdaad..9422436 100644
90 --- a/src/CMakeLists.txt
91 +++ b/src/CMakeLists.txt
92 @@ -17,7 +17,7 @@ set_target_properties(am7xxx PROPERTIES
93    VERSION ${PROJECT_VER}
94    SOVERSION ${PROJECT_APIVER})
95  install(TARGETS am7xxx
96 -  DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
97 +  DESTINATION "${CMAKE_INSTALL_LIBDIR}")
98  
99  add_library(am7xxx-static STATIC ${SRC})
100  set_target_properties(am7xxx-static PROPERTIES OUTPUT_NAME am7xxx)
101 @@ -25,7 +25,7 @@ if(UNIX AND NOT APPLE)
102    set_target_properties(am7xxx-static PROPERTIES COMPILE_FLAGS "-fPIC")
103  endif()
104  install(TARGETS am7xxx-static
105 -   DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
106 +  DESTINATION "${CMAKE_INSTALL_LIBDIR}")
107  
108  if(NOT WIN32)
109    find_library(MATH_LIB m)
110 @@ -39,11 +39,11 @@ target_link_libraries(am7xxx-static ${MATH_LIB} ${LIBUSB_1_LIBRARIES})
111  
112  # Install the header files
113  install(FILES "am7xxx.h"
114 -  DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
115 +  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
116  
117  if(UNIX AND NOT APPLE)
118    # Produce a pkg-config file for linking against the shared lib
119    configure_file("libam7xxx.pc.in" "libam7xxx.pc" @ONLY)
120    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libam7xxx.pc"
121 -    DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
122 +    DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
123  endif()
124 diff --git a/src/libam7xxx.pc.in b/src/libam7xxx.pc.in
125 index dff65c6..a596abc 100644
126 --- a/src/libam7xxx.pc.in
127 +++ b/src/libam7xxx.pc.in
128 @@ -1,7 +1,5 @@
129 -prefix=@CMAKE_INSTALL_PREFIX@
130 -exec_prefix=${prefix}
131 -libdir=${exec_prefix}/lib
132 -includedir=${prefix}/include
133 +libdir=@CMAKE_INSTALL_FULL_LIBDIR@
134 +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
135  
136  Name: @PROJECT_NAME@
137  Description: @PROJECT_DESCRIPTION@
138 -- 
139 2.16.2
140