aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-03-05 14:24:51 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-03-19 00:53:18 +0100
commitb8aff90997116a84350018f88f1eabdaa368d11b (patch)
tree5ee781b03d3ffa81bfdd813e91f6324a75b266e6 /examples
parent105862da3ea72c6763c26038d2e02cf243eb0798 (diff)
downloadqpdf-b8aff90997116a84350018f88f1eabdaa368d11b.tar.zst
Add cmake configuration files
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt52
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 00000000..40ecd603
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,52 @@
+set(EXAMPLE_CXX_PROGRAMS
+ pdf-attach-file
+ pdf-bookmarks
+ pdf-count-strings
+ pdf-create
+ pdf-custom-filter
+ pdf-double-page-size
+ pdf-filter-tokens
+ pdf-invert-images
+ pdf-mod-info
+ pdf-name-number-tree
+ pdf-npages
+ pdf-overlay-page
+ pdf-parse-content
+ pdf-set-form-values
+ pdf-split-pages
+ qpdf-job)
+set(EXAMPLE_C_PROGRAMS
+ pdf-c-objects
+ pdf-linearize
+ qpdfjob-c)
+
+foreach(PROG ${EXAMPLE_CXX_PROGRAMS})
+ add_executable(${PROG} ${PROG}.cc)
+ target_link_libraries(${PROG} libqpdf)
+endforeach()
+foreach(PROG ${EXAMPLE_C_PROGRAMS})
+ add_executable(${PROG} ${PROG}.c)
+ target_link_libraries(${PROG} libqpdf)
+ set_property(TARGET ${PROG} PROPERTY LINKER_LANGUAGE CXX)
+endforeach()
+target_include_directories(pdf-create PRIVATE ${JPEG_INCLUDE})
+
+add_test(
+ NAME examples
+ COMMAND ${RUN_QTEST}
+ --top ${qpdf_SOURCE_DIR}
+ --bin $<TARGET_FILE_DIR:pdf-create>
+ --bin $<TARGET_FILE_DIR:qpdf>
+ --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL
+ --code ${qpdf_SOURCE_DIR}/examples
+ --color ${QTEST_COLOR}
+ --show-on-failure ${SHOW_FAILED_TEST_OUTPUT}
+ --tc "${qpdf_SOURCE_DIR}/examples/*.cc"
+ --tc "${qpdf_SOURCE_DIR}/examples/*.c")
+
+file(GLOB EXAMPLES_SRC "*.c" "*.cc")
+if(INSTALL_EXAMPLES)
+ install(FILES ${EXAMPLES_SRC}
+ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples
+ COMPONENT ${COMPONENT_EXAMPLES})
+endif()