mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
25 lines
855 B
CMake
25 lines
855 B
CMake
|
|
find_package(Qt6 COMPONENTS Test REQUIRED)
|
|
set(QT_TEST_TARGET Qt6::Test)
|
|
|
|
# define names
|
|
set(BINARY_NAME qtcsv_tests)
|
|
|
|
# instruct CMake to run moc automatically when needed.
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
# add also the header part to source files. this is necessary for correct automoc
|
|
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
|
|
|
|
add_executable(${BINARY_NAME} ${SOURCE_FILES} )
|
|
|
|
TARGET_LINK_LIBRARIES(${BINARY_NAME} PRIVATE ${QT_TEST_TARGET} ${PROJECT_NAME})
|
|
|
|
# provide current project dir for projects header search path
|
|
target_include_directories(${BINARY_NAME} PRIVATE .)
|
|
|
|
# copy test files after build
|
|
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data)
|