Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Gtest for Qt Plugin

Gtest for Qt Plugin

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 159 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Parag Rudrawar
    wrote on last edited by
    #1

    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
    )
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved