Warning, /libraries/libqgit2/tests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 find_package(Qt5 REQUIRED Test) 0002 0003 set(testdir ${CMAKE_BINARY_DIR}/TestDir) 0004 file(MAKE_DIRECTORY ${testdir}) 0005 add_definitions(-DTEST_DIR=${testdir}) 0006 remove_definitions(-DMAKE_LIBQGIT2_LIB) 0007 0008 set(existing_repository ${testdir}/existing_repository) 0009 add_definitions(-DTEST_EXISTING_REPOSITORY=${existing_repository}) 0010 if(NOT EXISTS ${existing_repository}) 0011 message(STATUS "Creating test repository ...") 0012 file(MAKE_DIRECTORY ${existing_repository}) 0013 file(MAKE_DIRECTORY ${existing_repository}/.git) 0014 file(GLOB_RECURSE gitfiles RELATIVE ${CMAKE_SOURCE_DIR}/.git ${CMAKE_SOURCE_DIR}/.git/*) 0015 foreach(gitfile ${gitfiles}) 0016 configure_file(${CMAKE_SOURCE_DIR}/.git/${gitfile} ${existing_repository}/.git/${gitfile} COPYONLY) 0017 endforeach() 0018 endif() 0019 message(STATUS "Using test repository at '${existing_repository}'") 0020 0021 include_directories(${CMAKE_CURRENT_BINARY_DIR}) 0022 0023 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) 0024 0025 set(helper ${CMAKE_CURRENT_SOURCE_DIR}/TestHelpers) 0026 0027 macro(addTest name) 0028 set(_source ${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp) 0029 set(testname test${name}) 0030 add_executable(${testname} ${_source} ${helper}.h ${helper}.cpp) 0031 target_link_libraries(${testname} qgit2 PkgConfig::LIBGIT2 Qt5::Core Qt5::Test) 0032 set_target_properties(${testname} PROPERTIES AUTOMOC ON) 0033 add_test(NAME ${testname} COMMAND ${testname}) 0034 endmacro() 0035 0036 0037 addTest(Init) 0038 addTest(Revision) 0039 addTest(Clone) 0040 addTest(Fetch) 0041 addTest(Checkout) 0042 addTest(Push) 0043 addTest(Repository) 0044 addTest(Diff) 0045 addTest(Rebase)