Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df74c8a1af |
@ -70,6 +70,7 @@ install(FILES ${HEADERS} DESTINATION include/privatebinapi)
|
|||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
add_subdirectory(example)
|
||||||
|
|
||||||
# ===================== LLVM/clang-cl Coverage (optional) =====================
|
# ===================== LLVM/clang-cl Coverage (optional) =====================
|
||||||
option(ENABLE_LLVM_COVERAGE "Enable LLVM/clang-cl coverage instrumentation" OFF)
|
option(ENABLE_LLVM_COVERAGE "Enable LLVM/clang-cl coverage instrumentation" OFF)
|
||||||
|
|||||||
@ -24,4 +24,13 @@ target_link_libraries(example PRIVATE ${PRIVATEBINAPI_LIB} winhttp)
|
|||||||
|
|
||||||
target_include_directories(example PRIVATE
|
target_include_directories(example PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
${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()
|
||||||
@ -25,4 +25,13 @@ target_include_directories(test_basic PRIVATE
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Register the test with CTest
|
# 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()
|
||||||
Reference in New Issue
Block a user