forked from leezu/libzippp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
76 lines (64 loc) · 2.42 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
#
# CMakeLists.txt -- zip module
#
# Copyright (c) 2013-2018 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
cmake_minimum_required(VERSION 3.5)
project(zip)
set(ZIP_VERSION_MAJOR "1")
set(ZIP_VERSION_MINOR "0")
set(ZIP_VERSION_PATCH "0")
set(ZIP_VERSION "${ZIP_VERSION_MAJOR}.${ZIP_VERSION_MINOR}.${ZIP_VERSION_PATCH}")
option(BUILD_TESTS "Build test executable" OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${zip_SOURCE_DIR}/cmake)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++14 ${CMAKE_CXX_FLAGS}")
endif ()
find_package(ZIP REQUIRED)
find_package(Doxygen QUIET)
if(BUILD_TESTS)
add_subdirectory(gtest)
enable_testing()
add_executable(
zip
${zip_SOURCE_DIR}/zip.hpp
${zip_SOURCE_DIR}/test/main.cpp
${zip_SOURCE_DIR}/INSTALL.md
${zip_SOURCE_DIR}/LICENSE.md
${zip_SOURCE_DIR}/README.md
)
target_link_libraries(zip gtest ${ZIP_LIBRARIES})
target_include_directories(zip PRIVATE ${zip_SOURCE_DIR} ${ZIP_INCLUDE_DIRS})
target_compile_definitions(zip PRIVATE DIRECTORY=\"${zip_SOURCE_DIR}/test/data/\")
add_test(NAME zip COMMAND zip)
endif(BUILD_TESTS)
if (DOXYGEN_FOUND)
if (NOT DOXYGEN_DOT_FOUND)
set(DOXYGEN_HAVE_DOT "NO")
set(DOXYGEN_DOT_PATH "")
else ()
set(DOXYGEN_HAVE_DOT "YES")
set(DOXYGEN_DOT_PATH "\"${DOXYGEN_DOT_EXECUTABLE}\"")
endif ()
configure_file(${zip_SOURCE_DIR}/doc/Doxyfile.in ${zip_BINARY_DIR}/Doxyfile)
add_custom_target(
doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${zip_BINARY_DIR}/Doxyfile
SOURCES
${zip_SOURCE_DIR}/doc/Doxyfile.in
${zip_SOURCE_DIR}/doc/mainpage.cpp
WORKING_DIRECTORY ${zip_SOURCE_DIR}
)
endif ()