if(CMAKE_HOST_WIN32)
    set(libname "libconfig")
else()
    set(libname "config")
endif()

add_executable(libconfig_tests
    tests.c
)

target_link_libraries(libconfig_tests
    ${libname}
    libtinytest
)

add_test(
    NAME libconfig_tests
    COMMAND libconfig_tests
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
)

if(CMAKE_HOST_WIN32)
    set(libname "libconfig")
else()
    set(libname "config")
endif()

include_directories(${CMAKE_SOURCE_DIR}/lib)

add_executable(libconfig_tests
    tests.c
)

target_link_libraries(libconfig_tests
    ${libname}
    libtinytest
)

add_test(
    NAME libconfig_tests
    COMMAND libconfig_tests
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
)

Fix compilation of tests for out-of-tree-build
Fix compilation of tests for out-of-tree-build

We have to modify the include path, otherwise I get

| libconfig/tests/tests.c:31:10: fatal error: libconfig.h: No such file or directory
|    31 | #include <libconfig.h>
|       |          ^~~~~~~~~~~~~
| compilation terminated.

Signed-off-by: Bernhard Walle <657fa1668c09d5a5113a1a00440045db9f925152@ncp-e.com>
