Gtest for Qt Plugin
-
I need help to setup gtest for my Qt Plugin. Generally, when we write gtest for Qt app, we create the library of our application insteady of the binary. Something like this:
if(WITH_TEST)
add_library(GTestSample ${PROJECT_SOURCES})
else()
add_executable(GTestSample
${PROJECT_SOURCES}
)
endif()But how to do the same thing for plugin? Below is the cmakelist.txt for my TestPlugin
cmake_minimum_required(VERSION 3.10) # Remove when sharing with others. list(APPEND CMAKE_PREFIX_PATH "C:/Users/PARB1KOR/Desktop/TestPlugin") project(TestPlugin) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_CXX_STANDARD 17) find_package(QtCreator REQUIRED COMPONENTS Core) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) set(QtX Qt${QT_VERSION_MAJOR}) add_qtc_plugin(TestPlugin PLUGIN_DEPENDS QtCreator::Core DEPENDS ${QtX}::Widgets QtCreator::ExtensionSystem QtCreator::Utils SOURCES .github/workflows/build_cmake.yml .github/workflows/README.md README.md testplugin.cpp testplugin.h testplugin_global.h testpluginconstants.h )