Skip to content

Commit

Permalink
Call target_sources instead of appending source files
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Sep 4, 2024
1 parent 5ea4cc1 commit 65c3c9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
12 changes: 2 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,6 @@ set(ODR_SOURCE_FILES
"src/odr/internal/zip/zip_file.cpp"
"src/odr/internal/zip/zip_util.cpp"
)
if(WITH_PDF2HTMLEX)
LIST(APPEND ODR_SOURCE_FILES
"src/odr/internal/html/pdf2htmlEX_wrapper.cpp"
)
endif(WITH_PDF2HTMLEX)
if(WITH_WVWARE)
LIST(APPEND ODR_SOURCE_FILES
"src/odr/internal/html/wvWare_wrapper.cpp"
)
endif(WITH_WVWARE)

add_library(odr ${ODR_SOURCE_FILES})
set_target_properties(odr PROPERTIES OUTPUT_NAME odr)
Expand All @@ -205,10 +195,12 @@ target_link_libraries(odr
)

if(WITH_PDF2HTMLEX)
target_sources(odr PRIVATE "src/odr/internal/html/pdf2htmlEX_wrapper.cpp")
find_package(pdf2htmlEX REQUIRED)
target_link_libraries(odr PRIVATE pdf2htmlex::pdf2htmlex)
endif(WITH_PDF2HTMLEX)
if(WITH_WVWARE)
target_sources(odr PRIVATE "src/odr/internal/html/wvWare_wrapper.cpp")
find_package(wvware REQUIRED)
target_link_libraries(odr PRIVATE wvware::wvware)
endif(WITH_WVWARE)
Expand Down
14 changes: 2 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ configure_file("src/test_constants.cpp.in" "src/test_constants.cpp")

enable_testing()

if(WITH_PDF2HTMLEX)
LIST(APPEND ODR_TEST_SOURCE_FILES
"src/pdf2htmlEX_wrapper_test.cpp"
)
endif(WITH_PDF2HTMLEX)
if(WITH_WVWARE)
LIST(APPEND ODR_TEST_SOURCE_FILES
"src/wvWare_wrapper_test.cpp"
)
endif(WITH_WVWARE)
add_executable(odr_test
"src/test_util.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/src/test_constants.cpp"
Expand Down Expand Up @@ -54,8 +44,6 @@ add_executable(odr_test

"src/internal/zip/miniz_test.cpp"
"src/internal/zip/zip_archive_test.cpp"

${ODR_TEST_SOURCE_FILES}
)
target_include_directories(odr_test
PRIVATE
Expand All @@ -77,9 +65,11 @@ target_link_libraries(odr_test
)

if(WITH_PDF2HTMLEX)
target_sources(odr_test PRIVATE "src/pdf2htmlEX_wrapper_test.cpp")
target_link_libraries(odr_test PRIVATE pdf2htmlex::pdf2htmlex)
endif(WITH_PDF2HTMLEX)
if(WITH_WVWARE)
target_sources(odr_test PRIVATE "src/wvWare_wrapper_test.cpp")
target_link_libraries(odr_test PRIVATE wvware::wvware)
endif(WITH_WVWARE)

Expand Down

0 comments on commit 65c3c9b

Please sign in to comment.