2017-09-09 02:33:18 +08:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2017-01-21 22:04:10 +08:00
|
|
|
project(xlnt_all)
|
2015-11-03 03:22:13 +08:00
|
|
|
|
2016-10-28 06:40:20 +08:00
|
|
|
# This indicates to CMakeLists in subdirectories that they are part of a larger project
|
2017-01-21 22:04:10 +08:00
|
|
|
set(COMBINED_PROJECT TRUE)
|
2016-10-26 08:21:58 +08:00
|
|
|
|
|
|
|
# Library type
|
2017-03-11 07:33:20 +08:00
|
|
|
option(STATIC "Set to ON to build xlnt as a static library instead of a shared library" OFF)
|
2016-10-26 08:21:58 +08:00
|
|
|
|
2018-07-15 17:23:22 +08:00
|
|
|
# c++ language standard to use
|
2018-07-16 15:41:40 +08:00
|
|
|
set(XLNT_VALID_LANGS 11 14 17)
|
2018-07-15 17:23:22 +08:00
|
|
|
set(XLNT_CXX_LANG "14" CACHE STRING "c++ language features to compile with")
|
|
|
|
# enumerate allowed values for cmake gui
|
2018-07-16 15:41:40 +08:00
|
|
|
set_property(CACHE XLNT_CXX_LANG PROPERTY STRINGS ${XLNT_VALID_LANGS})
|
|
|
|
# validate value is in XLNT_VALID_LANGS
|
|
|
|
list(FIND XLNT_VALID_LANGS ${XLNT_CXX_LANG} index)
|
2018-07-15 17:23:22 +08:00
|
|
|
if(index EQUAL -1)
|
2018-07-16 15:41:40 +08:00
|
|
|
message(FATAL_ERROR "XLNT_CXX_LANG must be one of ${XLNT_VALID_LANGS}")
|
2018-07-15 17:23:22 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2016-10-26 08:21:58 +08:00
|
|
|
# Optional components
|
2017-03-19 09:30:26 +08:00
|
|
|
option(TESTS "Set to OFF to skip building test executable (in ./tests)" ON)
|
2016-10-28 06:40:20 +08:00
|
|
|
option(SAMPLES "Set to ON to build executable code samples (in ./samples)" OFF)
|
|
|
|
option(BENCHMARKS "Set to ON to build performance benchmarks (in ./benchmarks)" OFF)
|
2017-09-09 02:33:18 +08:00
|
|
|
option(PYTHON "Set to ON to build Arrow conversion functions (in ./python)" OFF)
|
2016-10-26 08:21:58 +08:00
|
|
|
|
|
|
|
# Platform specific options
|
2017-09-13 22:20:51 +08:00
|
|
|
if(MSVC)
|
|
|
|
option(STATIC_CRT "Link with the static version of MSVCRT (/MD[d])" OFF)
|
|
|
|
else()
|
2017-09-09 02:33:18 +08:00
|
|
|
option(COVERAGE "Generate coverage data using gcov" OFF)
|
2015-10-27 04:54:21 +08:00
|
|
|
endif()
|
|
|
|
|
2016-10-26 08:21:58 +08:00
|
|
|
# Add components according to selected options
|
2016-10-28 06:40:20 +08:00
|
|
|
if(SAMPLES)
|
2017-09-09 02:33:18 +08:00
|
|
|
add_subdirectory(samples)
|
2016-10-26 08:21:58 +08:00
|
|
|
endif()
|
2015-10-15 01:16:25 +08:00
|
|
|
|
2016-10-28 06:40:20 +08:00
|
|
|
if(BENCHMARKS)
|
2017-09-09 02:33:18 +08:00
|
|
|
add_subdirectory(benchmarks)
|
2015-11-04 12:02:43 +08:00
|
|
|
endif()
|
|
|
|
|
2017-03-19 09:30:26 +08:00
|
|
|
if(TESTS)
|
2017-09-09 02:33:18 +08:00
|
|
|
add_subdirectory(tests)
|
2016-12-14 16:27:09 +08:00
|
|
|
endif()
|
|
|
|
|
2017-07-31 00:48:57 +08:00
|
|
|
if(PYTHON)
|
2017-09-09 02:33:18 +08:00
|
|
|
add_subdirectory(python)
|
2017-07-01 22:46:48 +08:00
|
|
|
endif()
|
|
|
|
|
2016-10-26 08:21:58 +08:00
|
|
|
add_subdirectory(source)
|