diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b3dbfbea..907a9a87 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -132,7 +132,7 @@ add_dependencies(xlnt xlnt.third-party) target_link_libraries(xlnt PRIVATE libstudxml) target_include_directories(xlnt PUBLIC ${XLNT_INCLUDE_DIR}) target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}) -target_link_libraries(xlnt PUBLIC ${ZLIB_LIBRARY_RELEASE}) +target_link_libraries(xlnt PRIVATE ${ZLIB_LIBRARY_RELEASE}) target_include_directories(xlnt PRIVATE ${ZLIB_INCLUDE_DIR}) target_link_libraries(xlnt PRIVATE ${CRYPTOPP_LIBRARY_RELEASE}) target_include_directories(xlnt PRIVATE ${CRYPTOPP_INCLUDE_DIR}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 45c49760..99a2f02b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT COMBINED_PROJECT) add_subdirectory(${LIBRARY_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/source) endif() +# Tests uses the private interface of xlnt (source/detail) so it needs to explicitly link zlib +# as zlib is not part of xlnt's default link interface +find_package(ZLIB REQUIRED) + file(GLOB CELL_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/cell/tests/test_*.hpp) file(GLOB CHARTS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/charts/tests/test_*.hpp) file(GLOB CHARTSHEET_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/chartsheet/tests/test_*.hpp) @@ -39,11 +43,11 @@ endif() add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER}) target_link_libraries(xlnt.test PRIVATE xlnt) +target_link_libraries(xlnt.test PRIVATE ${ZLIB_LIBRARY_RELEASE}) target_include_directories(xlnt.test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../source - PRIVATE ${CXXTEST_INCLUDE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libstudxml) + PRIVATE ${CXXTEST_INCLUDE_DIR}) set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR})