forked from hunter-packages/giflib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
118 lines (101 loc) · 2.31 KB
/
CMakeLists.txt
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.0.0)
project(giflib VERSION 5.1.4)
set(GIFLIB_SRCS
"lib/dgif_lib.c"
"lib/egif_lib.c"
"lib/gif_font.c"
"lib/gif_hash.h"
"lib/gifalloc.c"
"lib/openbsd-reallocarray.c"
"lib/gif_err.c"
"lib/quantize.c"
"lib/gif_hash.c"
"lib/gif_lib.h"
"lib/gif_lib_private.h"
)
set(GIFLIB_INCLUDES
"lib/gif_lib.h"
)
add_library(giflib ${GIFLIB_SRCS})
if (WIN32)
# Suppress warnings to reduce build log size.
target_compile_options(giflib PRIVATE
"/wd4267"
"/wd4244"
"/wd4800"
"/wd4503"
"/wd4554"
"/wd4996"
"/wd4348"
"/wd4018"
"/wd4099"
"/wd4146"
"/wd4267"
"/wd4305"
"/wd4307"
"/wd4715"
"/wd4722"
"/wd4723"
"/wd4838"
"/wd4309"
"/wd4334"
"/wd4003"
"/wd4244"
"/wd4267"
"/wd4503"
"/wd4506"
"/wd4800"
"/wd4996"
"/wd8029"
)
endif()
target_include_directories(giflib
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/lib>"
)
if(WIN32)
target_include_directories(giflib
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/win32>"
)
endif()
### Install ###
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
# Note: use 'targets_export_name'
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
install(
TARGETS ${PROJECT_NAME}
EXPORT "${targets_export_name}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"
)
# expects: include <gif_lib.h>
install(
FILES "lib/gif_lib.h"
DESTINATION "${include_install_dir}"
)
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)