xlnt/CMakeLists.txt

75 lines
2.4 KiB
CMake
Raw Normal View History

2015-10-27 04:26:47 +08:00
cmake_minimum_required(VERSION 2.8.7)
2015-10-15 01:16:25 +08:00
2015-11-03 03:22:13 +08:00
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
2015-10-15 01:16:25 +08:00
project(xlnt)
option(SHARED "Set to OFF to not build shared libraries" ON)
option(STATIC "Set to ON to build static libraries" OFF)
option(DEBUG "Set to ON to for debug configuration" OFF)
2016-01-17 13:07:02 +08:00
option(EXAMPLES "Build examples" OFF)
option(TESTS "Build tests" OFF)
option(BENCHMARKS "Build performance benchmarks" OFF)
option(COVERAGE "Generate coverage data for use in Coveralls" OFF)
if(APPLE)
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
endif()
2015-11-21 23:57:45 +08:00
if(COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
if(DEBUG)
set(CMAKE_BUILD_TYPE "Debug")
else()
set(CMAKE_BUILD_TYPE "Release")
endif()
endif()
2015-10-26 14:07:52 +08:00
if(APPLE)
2016-01-17 13:07:02 +08:00
execute_process(COMMAND "sw_vers -productVersion | awk -F'.' '{print $1\".\"$2}'"
OUTPUT_VARIABLE OSX_VERSION
)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_VERSION})
2015-10-26 14:07:52 +08:00
endif(APPLE)
2015-10-15 01:16:25 +08:00
if(CMAKE_VERSION VERSION_LESS 3.1)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
2015-10-27 05:00:39 +08:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
else()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
2015-11-03 06:25:10 +08:00
add_definitions(-DUNICODE -D_UNICODE)
2015-10-27 04:54:21 +08:00
endif()
2016-01-17 13:07:02 +08:00
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2015-10-15 01:16:25 +08:00
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
2016-01-17 13:07:02 +08:00
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin)
2015-10-15 01:16:25 +08:00
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
2016-01-17 13:07:02 +08:00
if(TESTS)
include(cmake/xlnt.test.cmake)
endif()
2016-01-17 13:07:02 +08:00
include(cmake/xlnt.cmake)