summaryrefslogtreecommitdiff
blob: e4c6296f1d7f6bba2d8dd062d7edbea246a67c5e (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From c43cc918c3e79e324f11ca47e95bfe36e9e0dd15 Mon Sep 17 00:00:00 2001
From: Jonathan Scruggs <j.scruggs@gmail.com>
Date: Sun, 14 Jan 2018 19:59:31 +0000
Subject: [PATCH] Add GNUInstallDirs variables and fix install location for
 cmake files

GNUInstallDirs is supported on all platforms and variables are set
to the standard GNU locations.

This patch corrects the location where the CMake files are
installed.

Signed-off by: Jonathan Scruggs <j.scruggs@gmail.com>
---
 CMakeLists.txt                     | 9 +++++----
 docs/CMakeLists.txt                | 4 ++--
 export/pkgconfig/OpenColorIO.pc.in | 6 ++----
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b05c7e4..452fa1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,7 @@ endif()
 include(ParseArguments)
 include(OCIOMacros)
 include(ExternalProject)
+include(GNUInstallDirs)
 
 enable_language(CXX)
 
@@ -531,7 +532,7 @@ endif()
 configure_file(${CMAKE_SOURCE_DIR}/share/ocio/setup_ocio.sh.in
     ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh @ONLY)
 
-INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh DESTINATION share/ocio/)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh DESTINATION ${CMAKE_INSTALL_DATADIR}/ocio/)
 
 ###############################################################################
 ### CPACK ###
@@ -596,7 +597,7 @@ if(TARGET OpenColorIO_STATIC)
         set(OCIO_STATIC_COMPILE_DEFINITIONS )
     endif()
 endif()
-install(EXPORT OpenColorIO DESTINATION cmake)
+install(EXPORT OpenColorIO DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenColorIO)
 file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake"
     "
     get_filename_component(OpenColorIO_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)
@@ -608,7 +609,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake"
     
     ## targets libraries + associated definitions
     if(NOT TARGET OpenColorIO)
-        include(\"\${OpenColorIO_DIR}/cmake/OpenColorIO.cmake\") ## thanks to imported target
+        include(\"\${OpenColorIO_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/OpenColorIO/OpenColorIO.cmake\") ## thanks to imported target
         if(TARGET OpenColorIO AND NOT OpenColorIO_USE_STATIC)
             message(STATUS \"shared target OpenColorIO : see OpenColorIO_LIBRARY\")
             set(OpenColorIO_LIBRARY         OpenColorIO)
@@ -646,4 +647,4 @@ file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake"
     message(STATUS OPENCOLORIO_FOUND=\${OPENCOLORIO_FOUND})
     "
 )
-install(FILES "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION .)
+install(FILES "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenColorIO)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 3fd0299..a822a19 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -138,7 +138,7 @@ add_custom_target(doc ALL
 add_dependencies(doc Sphinx) 
 
 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build-html/
-        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/OpenColorIO/html
+        DESTINATION ${CMAKE_INSTALL_DOCDIR}/html
         PATTERN .* EXCLUDE
 )
 
@@ -166,6 +166,6 @@ if(PDFLATEX_COMPILER)
     add_dependencies(pdf latex)
     
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/build-latex/OpenColorIO.pdf
-            DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/OpenColorIO/)
+            DESTINATION ${CMAKE_INSTALL_DOCDIR})
     
 endif()
diff --git a/export/pkgconfig/OpenColorIO.pc.in b/export/pkgconfig/OpenColorIO.pc.in
index 81ab4ce3..c4553a4f 100644
--- a/export/pkgconfig/OpenColorIO.pc.in
+++ b/export/pkgconfig/OpenColorIO.pc.in
@@ -1,7 +1,5 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_EXEC_PREFIX@
-includedir=${prefix}/include
-libdir=${exec_prefix}/lib@LIB_SUFFIX@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
 
 Name: OpenColorIO
 Description: A color management framework for visual effects and animation
-- 
2.15.1