forked from rbulygin/QtXlsxWriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
131 lines (111 loc) · 3.27 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
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required(VERSION 3.2)
project(QtXlsxWriter)
add_definitions(-DQT_BUILD_XLSX_LIB)
set(BUILD_SHARED_LIBS TRUE)
set(CMAKE_AUTOMOC ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
file(
GLOB
QtXlsxWriter_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx/*.h
${CMAKE_CURRENT_BINARY_DIR}/QtXlsxWriterTest_automoc.cpp
)
find_package(Qt5 5.5 REQUIRED Core Gui Test)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/xlsx/
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Gui_PRIVATE_INCLUDE_DIRS} )
add_library(QtXlsxWriter SHARED "${QtXlsxWriter_SOURCE_FILES}")
# automatically add C++11 support with GCC
if(NOT MSVC)
target_compile_features(QtXlsxWriter PRIVATE cxx_range_for)
endif()
##
#
# Define product version.
#
# Version is making form "git describe" output if avalable
# or hardcoded base version is used when git is not available
#
##
set (PRODUCT_VERSION 0.4)
set (PRODUCT_SOVERSION 0)
execute_process(COMMAND git describe --long --match "v[0-9]*"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PRODUCT_VERSION_GIT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(PRODUCT_VERSION_GIT)
string(REGEX REPLACE
"^v([0-9]+)\\.([0-9]+)-([0-9]+).*$"
"\\1\.\\2\.\\3"
PRODUCT_VERSION
${PRODUCT_VERSION_GIT} )
endif()
message(STATUS "Version is: ${PRODUCT_VERSION}")
message(STATUS ".so version is: ${PRODUCT_SOVERSION}")
##
#
# Properties
#
##
set_target_properties(QtXlsxWriter PROPERTIES VERSION ${PRODUCT_VERSION} SOVERSION ${PRODUCT_SOVERSION})
set_target_properties(QtXlsxWriter PROPERTIES DEBUG_POSTFIX "d")
target_link_libraries(QtXlsxWriter ${Qt5Core_LIBRARIES})
target_link_libraries(QtXlsxWriter ${Qt5Gui_LIBRARIES})
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
if(BUILD_EXAMPLES)
add_custom_command(TARGET QtXlsxWriter POST_BUILD
COMMAND ${CMAKE_COMMAND}
-E copy_directory $<CONFIGURATION> ${CMAKE_CURRENT_BINARY_DIR}/examples/xlsx/$<CONFIGURATION>)
add_subdirectory(examples/xlsx)
endif()
##
#
# QtxlsxwriterVersion.cmake creation
#
##
set(QtXlsxWriter_CONFIG_PATH ${CMAKE_INSTALL_PREFIX})
configure_file(QtXlsxWriterConfig.cmake.in QtXlsxWriterConfig.cmake @ONLY)
#####
#
# Installation configuration
#
#####
INSTALL(TARGETS QtXlsxWriter
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/QtXlsxWriterConfig.cmake DESTINATION
lib${LIB_SUFFIX}/cmake/${PROJECT_NAME})
SET(INCLUDE_FILES
src/xlsx/xlsx_CT_HeaderFooter.hpp
src/xlsx/xlsx_CT_PageSetup.hpp
src/xlsx/xlsx_xml_exception.hpp
src/xlsx/xlsxabstractooxmlfile.h
src/xlsx/xlsxabstractsheet.h
src/xlsx/xlsxcell.h
src/xlsx/xlsxcellformula.h
src/xlsx/xlsxcellrange.h
src/xlsx/xlsxcellreference.h
src/xlsx/xlsxchart.h
src/xlsx/xlsxchartsheet.h
src/xlsx/xlsxconditionalformatting.h
src/xlsx/xlsxdatavalidation.h
src/xlsx/xlsxdocument.h
src/xlsx/xlsxformat.h
src/xlsx/xlsxformula.h
src/xlsx/xlsxglobal.h
src/xlsx/xlsxmarker.h
src/xlsx/xlsxrichstring.h
src/xlsx/xlsxworkbook.h
src/xlsx/xlsxworksheet.h
)
INSTALL(FILES ${INCLUDE_FILES} DESTINATION include)