cmake_minimum_required(VERSION 3.2) project(xlnt.test) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) if(NOT COMBINED_PROJECT) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source) endif() file(GLOB CELL_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/cell/test_*.hpp) file(GLOB PACKAGING_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/test_*.hpp) file(GLOB STYLES_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/styles/test_*.hpp) file(GLOB UTILS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/utils/test_*.hpp) file(GLOB WORKBOOK_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/workbook/test_*.hpp) file(GLOB WORKSHEET_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/worksheet/test_*.hpp) set(TESTS ${CELL_TESTS} ${PACKAGING_TESTS} ${STYLES_TESTS} ${UTILS_TESTS} ${WORKBOOK_TESTS} ${WORKSHEET_TESTS}) file(GLOB HELPERS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/helpers/*.hpp) file(GLOB HELPERS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/helpers/*.cpp) set(HELPERS ${HELPERS_HEADERS} ${HELPERS_SOURCES}) set(RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/runner.cpp) if(COVERAGE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") endif() add_executable(xlnt.test ${RUNNER} ${HELPERS} $) target_link_libraries(xlnt.test PRIVATE xlnt) target_include_directories(xlnt.test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../source PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libstudxml) set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR}) source_group(helpers FILES ${HELPERS}) source_group(tests\\cell FILES ${CELL_TESTS}) source_group(tests\\packaging FILES ${PACKAGING_TESTS}) source_group(tests\\serialization FILES ${SERIALIZATION_TESTS}) source_group(tests\\styles FILES ${STYLES_TESTS}) source_group(tests\\utils FILES ${UTILS_TESTS}) source_group(tests\\workbook FILES ${WORKBOOK_TESTS}) source_group(tests\\worksheet FILES ${WORKSHEET_TESTS}) if(MSVC AND NOT STATIC) add_custom_command(TARGET xlnt.test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) endif()