Cleanup some cmake modifications

This commit is contained in:
Crzyrndm 2018-07-16 19:41:40 +12:00
parent ad759ae4f7
commit 0aee6fd9b1
3 changed files with 7 additions and 5 deletions

View File

@ -8,14 +8,14 @@ set(COMBINED_PROJECT TRUE)
option(STATIC "Set to ON to build xlnt as a static library instead of a shared library" OFF) option(STATIC "Set to ON to build xlnt as a static library instead of a shared library" OFF)
# c++ language standard to use # c++ language standard to use
set(XLNT_LANGS 11 14 17) set(XLNT_VALID_LANGS 11 14 17)
set(XLNT_CXX_LANG "14" CACHE STRING "c++ language features to compile with") set(XLNT_CXX_LANG "14" CACHE STRING "c++ language features to compile with")
# enumerate allowed values for cmake gui # enumerate allowed values for cmake gui
set_property(CACHE XLNT_CXX_LANG PROPERTY STRINGS ${XLNT_LANGS}) set_property(CACHE XLNT_CXX_LANG PROPERTY STRINGS ${XLNT_VALID_LANGS})
# validate value is in XLNT_LANGS # validate value is in XLNT_VALID_LANGS
list(FIND XLNT_LANGS ${XLNT_CXX_LANG} index) list(FIND XLNT_VALID_LANGS ${XLNT_CXX_LANG} index)
if(index EQUAL -1) if(index EQUAL -1)
message(FATAL_ERROR "XLNT_CXX_LANG must be one of ${XLNT_LANGS}") message(FATAL_ERROR "XLNT_CXX_LANG must be one of ${XLNT_VALID_LANGS}")
endif() endif()

View File

@ -154,6 +154,7 @@ else()
target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1) target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1)
endif() endif()
# requires cmake 3.8+
#target_compile_features(xlnt PUBLIC cxx_std_${XLNT_CXX_LANG}) #target_compile_features(xlnt PUBLIC cxx_std_${XLNT_CXX_LANG})
# Includes # Includes

View File

@ -48,6 +48,7 @@ target_include_directories(xlnt.test
set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR}) target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR})
# requires cmake 3.8+
#target_compile_features(xlnt.test PRIVATE cxx_std_${XLNT_CXX_LANG}) #target_compile_features(xlnt.test PRIVATE cxx_std_${XLNT_CXX_LANG})
if(MSVC) if(MSVC)