1 Commits

3 changed files with 21 additions and 2 deletions

View File

@ -70,6 +70,7 @@ install(FILES ${HEADERS} DESTINATION include/privatebinapi)
include(CTest)
enable_testing()
add_subdirectory(tests)
add_subdirectory(example)
# ===================== LLVM/clang-cl Coverage (optional) =====================
option(ENABLE_LLVM_COVERAGE "Enable LLVM/clang-cl coverage instrumentation" OFF)

View File

@ -24,4 +24,13 @@ target_link_libraries(example PRIVATE ${PRIVATEBINAPI_LIB} winhttp)
target_include_directories(example PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../include
)
)
# Install/run helpers for tests: copy DLL next to example on Windows
if(WIN32)
add_custom_command(TARGET example POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PRIVATEBINAPI_BUILD_DIR}/Release/privatebinapi.dll
$<TARGET_FILE_DIR:example>
)
endif()

View File

@ -25,4 +25,13 @@ target_include_directories(test_basic PRIVATE
)
# Register the test with CTest
add_test(NAME test_basic COMMAND test_basic)
add_test(NAME test_basic COMMAND test_basic)
# Optional example run as a test (requires network and live server)
# Example-Test nur aktiv, wenn PRIVATEBIN_IT=1 gesetzt ist
add_test(NAME example_run COMMAND $<TARGET_FILE:example>)
if(DEFINED ENV{PRIVATEBIN_IT} AND NOT "$ENV{PRIVATEBIN_IT}" STREQUAL "0")
set_tests_properties(example_run PROPERTIES DISABLED FALSE)
else()
set_tests_properties(example_run PROPERTIES DISABLED TRUE)
endif()