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
|
* Fix build system to honour Gentoo's multilib-strict (lib32/lib64)
* jiv also requires OpenGL libs, not just GLUT
* Only look for OpenGL+GLUT if JAS_ENABLE_OPENGL is actually on
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,7 @@
option(JAS_ENABLE_OPENGL "Enable use of OpenGL Library" true)
option(JAS_ENABLE_STRICT "Enable pedantic error checking" false)
option(JAS_ENABLE_SHARED "Enable building of shared library" true)
+option(CMAKE_INSTALL_LIBDIR "Path to install libraries into" lib)
if (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX true)
@@ -173,21 +174,18 @@
# set(JPEG_INCLUDE_DIR "")
#endif()
-find_package(GLUT)
-if(GLUT_FOUND)
- include_directories("${GLUT_INCLUDE_DIR}")
-endif()
-check_include_files(GL/glut.h JAS_HAVE_GL_GLUT_H)
-message("GLUT library found: ${GLUT_FOUND}")
-message("GLUT libraries: ${GLUT_LIBRARIES}")
-message("GLUT include directory: ${GLUT_INCLUDE_DIR}")
-message("JAS_ENABLE_OPENGL: ${JAS_ENABLE_OPENGL}")
-message("JAS_HAVE_GL_GLUT_H: ${JAS_HAVE_GL_GLUT_H}")
-if(GLUT_FOUND AND (NOT JAS_HAVE_GL_GLUT_H OR NOT JAS_ENABLE_OPENGL))
- message("disabling GLUT")
- set(GLUT_FOUND false)
- set(GLUT_LIBRARIES "")
- set(GLUT_INCLUDE_DIR "")
+if(JAS_ENABLE_OPENGL)
+ find_package(OpenGL REQUIRED)
+ find_package(GLUT REQUIRED)
+
+ check_include_files(GL/glut.h JAS_HAVE_GL_GLUT_H)
+ message("GLUT library found: ${GLUT_FOUND}")
+ message("GLUT libraries: ${GLUT_LIBRARIES}")
+ message("GLUT include directory: ${GLUT_INCLUDE_DIR}")
+ message("JAS_HAVE_GL_GLUT_H: ${JAS_HAVE_GL_GLUT_H}")
+ if(NOT JAS_HAVE_GL_GLUT_H)
+ message(FATAL_ERROR "GL/glut.h cannot be found or is not working.")
+ endif()
endif()
if(UNIX)
@@ -219,7 +217,7 @@
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ENDIF("${isSystemDir}" STREQUAL "-1")
################################################################################
@@ -275,7 +273,7 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build/jasper.pc.in
${CMAKE_CURRENT_BINARY_DIR}/build/jasper.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/build/jasper.pc
- DESTINATION lib/pkgconfig)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build/jasper.spec.in
${CMAKE_CURRENT_BINARY_DIR}/build/jasper.spec @ONLY)
--- a/src/appl/CMakeLists.txt
+++ b/src/appl/CMakeLists.txt
@@ -22,7 +22,7 @@
# The jiv program (which requires GLUT)
if(GLUT_FOUND)
add_executable(jiv jiv.c)
- target_link_libraries(jiv libjasper ${JPEG_LIBRARIES} ${GLUT_LIBRARIES} ${MATH_LIBRARY})
+ target_link_libraries(jiv libjasper ${JPEG_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${MATH_LIBRARY})
set(programs "${programs}" jiv)
set(man_pages "${man_pages}" jiv.1)
else()
@@ -33,4 +33,4 @@
install(TARGETS ${programs} DESTINATION bin)
# Install the manual pages for the programs that were built.
-install(FILES ${man_pages} DESTINATION man)
+install(FILES ${man_pages} DESTINATION share/man/man1)
--- a/src/libjasper/CMakeLists.txt
+++ b/src/libjasper/CMakeLists.txt
@@ -151,5 +151,5 @@
# MacOSX does cannot build a shared library without this line.
target_link_libraries(libjasper ${JPEG_LIBRARIES})
-install(TARGETS libjasper DESTINATION lib)
+install(TARGETS libjasper DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${libjasper_headers} DESTINATION include/jasper)
|