1 # build and add test only if tests are enabled
3 include_directories(${gtest_INCLUDE_DIRS})
6 -DTEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/"
7 -DGIT_COMMIT="AppImageKit unit tests"
11 # Link runTests with what we want to test and the GTest and pthread library
12 add_executable(test_libappimage
17 target_link_libraries(test_libappimage
23 if(NOT USE_SYSTEM_GTEST)
24 add_dependencies(test_libappimage gtest)
27 add_test(test_libappimage test_libappimage)
30 add_executable(test_shared
33 ${PROJECT_SOURCE_DIR}/src/shared.c
34 ${PROJECT_SOURCE_DIR}/src/elf.c
35 ${PROJECT_SOURCE_DIR}/src/getsection.c
38 target_link_libraries(test_shared
40 ${squashfuse_LIBRARIES}
41 ${libarchive_LIBRARIES}
42 ${inotify-tools_LIBRARIES}
52 target_include_directories(test_shared PRIVATE ../src/)
54 add_dependencies(test_shared squashfuse)
56 if(NOT USE_SYSTEM_LIBARCHIVE)
57 add_dependencies(test_shared libarchive)
60 if(NOT USE_SYSTEM_INOTIFY_TOOLS)
61 add_dependencies(test_shared inotify-tools)
64 if(NOT USE_SYSTEM_GTEST)
65 add_dependencies(test_shared gtest)
68 add_test(test_shared test_shared)
70 target_compile_options(test_shared PRIVATE -fpermissive)
73 add_executable(test_getsection
76 ${PROJECT_SOURCE_DIR}/src/light_elf.h
77 ${PROJECT_SOURCE_DIR}/src/light_byteswap.h
78 ${PROJECT_SOURCE_DIR}/src/elf.c
79 ${PROJECT_SOURCE_DIR}/src/getsection.c
82 target_link_libraries(test_getsection
84 ${squashfuse_LIBRARIES}
85 ${libarchive_LIBRARIES}
86 ${inotify-tools_LIBRARIES}
96 target_include_directories(test_getsection PRIVATE ../src/)
98 add_dependencies(test_getsection squashfuse)
100 if(NOT USE_SYSTEM_LIBARCHIVE)
101 add_dependencies(test_getsection libarchive)
104 if(NOT USE_SYSTEM_INOTIFY_TOOLS)
105 add_dependencies(test_getsection inotify-tools)
108 if(NOT USE_SYSTEM_GTEST)
109 add_dependencies(test_getsection gtest)
112 add_test(test_getsection test_getsection)
114 target_compile_options(test_getsection PRIVATE -fpermissive)