# cmake --build . && ctest --verbose

cmake_minimum_required(VERSION 3.12)

enable_testing()

find_package(PkgConfig)

pkg_check_modules(Check
REQUIRED
    check
IMPORTED_TARGET
)


add_subdirectory(sem-wrapper)

add_executable(test-bugs)

target_sources(test-bugs
PRIVATE
    "${CMAKE_CURRENT_SOURCE_DIR}/test_bugs.c"
)

target_link_libraries(test-bugs
PRIVATE
    PkgConfig::Check
    sem-wrapper
)


add_test(test-bugs
    test-bugs
WORKING_DIRECTORY
    "${CMAKE_CURRENT_BINARY_DIR}"
)

if(TARGET build-tests)
    add_dependencies(build-tests
        test-bugs
    )
endif()
