2015-10-26 16:26:47 -04:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
2015-10-14 13:16:25 -04:00
|
|
|
|
2015-11-02 14:22:13 -05:00
|
|
|
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
|
|
|
|
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
|
|
|
|
endif()
|
|
|
|
|
2015-10-14 13:16:25 -04:00
|
|
|
project(xlnt)
|
|
|
|
|
2015-11-20 23:34:39 -05:00
|
|
|
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)
|
2015-11-03 23:02:43 -05:00
|
|
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
|
|
|
option(BUILD_TESTS "Build tests runner" OFF)
|
2015-11-10 19:47:31 -05:00
|
|
|
option(COVERAGE "Create coverage files" OFF)
|
2015-11-03 23:02:43 -05:00
|
|
|
|
2015-11-20 23:34:39 -05:00
|
|
|
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
|
|
|
if(DEBUG)
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
else()
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-10-26 02:07:52 -04:00
|
|
|
if(APPLE)
|
2015-10-26 16:54:21 -04:00
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
|
2015-10-26 02:07:52 -04:00
|
|
|
endif(APPLE)
|
2015-10-14 13:16:25 -04:00
|
|
|
|
2015-11-02 14:22:13 -05:00
|
|
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
2015-10-26 17:00:39 -04:00
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
|
2015-10-26 17:03:03 -04:00
|
|
|
else()
|
2015-10-26 17:00:39 -04:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
|
|
|
endif()
|
2015-11-02 14:22:13 -05:00
|
|
|
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
2015-11-20 21:35:50 -05:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
2015-11-02 14:22:13 -05:00
|
|
|
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
2015-11-02 17:25:10 -05:00
|
|
|
add_definitions(-DUNICODE -D_UNICODE)
|
2015-10-26 16:54:21 -04:00
|
|
|
endif()
|
|
|
|
|
2015-11-01 12:31:29 -05: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-14 13:16:25 -04:00
|
|
|
|
|
|
|
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
2015-11-01 12:31:29 -05: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-14 13:16:25 -04:00
|
|
|
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
|
|
|
|
2015-11-03 23:02:43 -05:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
include(xlnt.test.cmake)
|
|
|
|
endif()
|
|
|
|
|
2015-11-01 23:52:19 -05:00
|
|
|
include(xlnt.cmake)
|