xlnt/cmake/CMakeLists.txt

46 lines
1.5 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 build static libraries" ON)
option(BUILD_EXAMPLES "Build examples" OFF)
option(BUILD_TESTS "Build tests runner" OFF)
option(AUTORUN_TESTS "Automatically run tests after building" OFF)
2015-10-26 14:07:52 +08:00
if(APPLE)
2015-10-27 04:54:21 +08:00
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
2015-10-26 14:07:52 +08:00
endif(APPLE)
2015-10-15 01:16:25 +08:00
2015-11-03 03:22:13 +08:00
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
2015-10-27 05:00:39 +08:00
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
2015-10-27 05:03:03 +08:00
else()
2015-10-27 05:00:39 +08:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
2015-11-03 03:22:13 +08:00
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
2015-10-27 04:54:21 +08:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
2015-11-03 03:22:13 +08:00
elseif(${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()
2015-11-02 01:31:29 +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)
2015-11-02 01:31:29 +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)
if(BUILD_TESTS)
include(xlnt.test.cmake)
endif()
2015-11-02 12:52:19 +08:00
include(xlnt.cmake)