Add unit testes
This commit is contained in:
54
tests/FireNSmokeDetection/CMakeLists.txt
Normal file
54
tests/FireNSmokeDetection/CMakeLists.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
project(FireNSmokeDetection_Tests LANGUAGES CXX)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
FireNSmokeDetectionTest.cpp
|
||||
)
|
||||
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
$<$<CONFIG:Debug>:_DEBUG>
|
||||
$<$<CONFIG:Release>:NDEBUG>
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${TEST_COMMON_DIR}
|
||||
${ANSLIB_INCLUDE_DIR}
|
||||
${OPENCV_INCLUDE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/ANSCustomFireNSmokeDetection
|
||||
)
|
||||
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE
|
||||
${ANSLIB_LIB_DIR}
|
||||
${OPENCV_LIB_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
gtest
|
||||
gtest_main
|
||||
ANSLIB
|
||||
opencv_world4130
|
||||
ANSCustomFireNSmokeDetection
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /W3 /sdl /permissive-)
|
||||
endif()
|
||||
|
||||
# Copy required DLLs next to the test executable so Windows can find them
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
# ANSLIB.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${ANSLIB_LIB_DIR}/ANSLIB.dll"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
# OpenCV DLL
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${OPENCV_BIN_DIR}/opencv_world4130.dll"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying runtime DLLs for ${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(${PROJECT_NAME} DISCOVERY_MODE PRE_TEST)
|
||||
Reference in New Issue
Block a user