forked from DanBloomberg/leptonica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
117 lines (90 loc) · 2.99 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
#
# leptonica
#
###############################################################################
#
# cmake settings
#
###############################################################################
cmake_minimum_required(VERSION 2.8.11)
# In-source builds are disabled.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"CMake generation is not possible within the source directory!"
"\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
"\n "
"\n rm CMakeCache.txt"
"\n mkdir build"
"\n cd build"
"\n cmake .."
)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
# Use solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")
###############################################################################
#
# project settings
#
###############################################################################
project(leptonica C CXX)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 73)
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})
find_package(GIF)
find_package(JPEG)
find_package(PNG)
find_package(TIFF)
find_package(ZLIB)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(WEBP libwebp)
pkg_check_modules(JP2K libopenjp2)
endif()
###############################################################################
#
# compiler and linker
#
###############################################################################
set(LIBRARY_TYPE SHARED)
if (STATIC)
set(LIBRARY_TYPE)
endif()
if (WIN32)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
endif()
###############################################################################
#
# configure
#
###############################################################################
set(AUTOCONFIG_SRC ${CMAKE_BINARY_DIR}/config_auto.h.in)
set(AUTOCONFIG ${CMAKE_BINARY_DIR}/src/config_auto.h)
include(Configure)
configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/templates/LeptonicaConfig-version.cmake.in
${CMAKE_BINARY_DIR}/LeptonicaConfig-version.cmake @ONLY)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/templates/LeptonicaConfig.cmake.in
${CMAKE_BINARY_DIR}/LeptonicaConfig.cmake @ONLY)
###############################################################################
#
# build
#
###############################################################################
add_definitions(-DHAVE_CONFIG_H)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
if (BUILD_PROG)
add_subdirectory(prog)
endif()
add_subdirectory(src)
###############################################################################