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. CMake configuration of plugin for SQL Driver
Forum Updated to NodeBB v4.3 + New Features

CMake configuration of plugin for SQL Driver

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 576 Views 1 Watching
  • 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.
  • Hans DijkemaH Offline
    Hans DijkemaH Offline
    Hans Dijkema
    wrote on last edited by
    #1

    Followup of bug https://bugreports.qt.io/browse/QTBUG-113798.

    I do not seem to get the CMake code working for my own SQLite AES encryption plugin. I've configured this:

    cmake_minimum_required(VERSION 3.16)
    
    set(QSQLiteAES_VERSION "6.5.1")
    
    project(qsqlite-aes2 LANGUAGES C CXX)
    project(QSQLiteAES2DriverPlugins
        VERSION "${SQLiteAES_VERSION}"
        DESCRIPTION "Qt6 SQL driver plugins for SQLite, with AES encryption"
        HOMEPAGE_URL "https://github.com/hdijkema/qsqlite-aes"
        LANGUAGES CXX C
    )
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Sql)
    qt_prepare_standalone_project()
    
    qt_internal_add_plugin(QSQLiteAES2Plugin
        OUTPUT_NAME qsqlite-aes
        PLUGIN_TYPE sqldrivers
        SOURCES
          qsqliteaes.cpp
          qsqliteaes.h
          codec.cpp
          codec.h
          codec_c_interface.h
          codecext.c
          qsql_sqlite.cpp
          qsql_sqlite_p.h
          qtv.h
          shell.c
          sqlite3.c
          sqlite3.h
          sqlite3ext.h
          AES.cpp
          AES.h
          qsqlite-aes2_5_15_2.json
          qsqlite-aes2_6_5_1.json
        DEFINES
            QT_NO_CAST_FROM_ASCII
            QT_NO_CAST_TO_ASCII
        LIBRARIES
            Qt::Core
            Qt::CorePrivate
            Qt::SqlPrivate
    )
    
    qt_internal_extend_target(QSQLiteAES2Plugin
        LIBRARIES
            SQLite::SQLiteAES
    )
    

    As you can see, I really don't exactly know what I'm doing here, just following a recipe.

    The output of CMake is this:

    Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/devel/libs_with_qt/qsqlite-aes2 -B C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\devel\libs_with_qt\build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.5.1/msvc2019_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.5.1/msvc2019_64" "-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" in C:\devel\libs_with_qt\build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release.
    -- The C compiler identification is MSVC 19.28.29912.0
    -- The CXX compiler identification is MSVC 19.28.29912.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - not found
    -- Found Threads: TRUE  
    -- Performing Test HAVE_STDATOMIC
    -- Performing Test HAVE_STDATOMIC - Success
    -- Found WrapAtomic: TRUE  
    CMake Error at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtTargetHelpers.cmake:266 (add_library):
      add_library cannot create ALIAS target "Qt::QSQLiteAES2Plugin" because
      another target with the same name already exists.
    Call Stack (most recent call first):
      C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtPluginHelpers.cmake:153 (qt_internal_add_target_aliases)
      CMakeLists.txt:60 (qt_internal_add_plugin)
    
    
    CMake Error at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtAutogenHelpers.cmake:10 (set_directory_properties):
      set_directory_properties Wrong number of arguments
    Call Stack (most recent call first):
      C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtPluginHelpers.cmake:170 (qt_autogen_tools_initial_setup)
      CMakeLists.txt:60 (qt_internal_add_plugin)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/CMakeFiles/CMakeOutput.log".
    See also "C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/CMakeFiles/CMakeError.log".
    CMake process exited with exit code 1.
    
    Elapsed time: 00:07.
    
    

    Can someone help me with this issue?

    Thanks in advance.

    Hans DijkemaH 1 Reply Last reply
    0
    • Hans DijkemaH Hans Dijkema

      Followup of bug https://bugreports.qt.io/browse/QTBUG-113798.

      I do not seem to get the CMake code working for my own SQLite AES encryption plugin. I've configured this:

      cmake_minimum_required(VERSION 3.16)
      
      set(QSQLiteAES_VERSION "6.5.1")
      
      project(qsqlite-aes2 LANGUAGES C CXX)
      project(QSQLiteAES2DriverPlugins
          VERSION "${SQLiteAES_VERSION}"
          DESCRIPTION "Qt6 SQL driver plugins for SQLite, with AES encryption"
          HOMEPAGE_URL "https://github.com/hdijkema/qsqlite-aes"
          LANGUAGES CXX C
      )
      
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      set(CMAKE_CXX_STANDARD 17)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Sql)
      qt_prepare_standalone_project()
      
      qt_internal_add_plugin(QSQLiteAES2Plugin
          OUTPUT_NAME qsqlite-aes
          PLUGIN_TYPE sqldrivers
          SOURCES
            qsqliteaes.cpp
            qsqliteaes.h
            codec.cpp
            codec.h
            codec_c_interface.h
            codecext.c
            qsql_sqlite.cpp
            qsql_sqlite_p.h
            qtv.h
            shell.c
            sqlite3.c
            sqlite3.h
            sqlite3ext.h
            AES.cpp
            AES.h
            qsqlite-aes2_5_15_2.json
            qsqlite-aes2_6_5_1.json
          DEFINES
              QT_NO_CAST_FROM_ASCII
              QT_NO_CAST_TO_ASCII
          LIBRARIES
              Qt::Core
              Qt::CorePrivate
              Qt::SqlPrivate
      )
      
      qt_internal_extend_target(QSQLiteAES2Plugin
          LIBRARIES
              SQLite::SQLiteAES
      )
      

      As you can see, I really don't exactly know what I'm doing here, just following a recipe.

      The output of CMake is this:

      Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/devel/libs_with_qt/qsqlite-aes2 -B C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\devel\libs_with_qt\build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.5.1/msvc2019_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.5.1/msvc2019_64" "-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" in C:\devel\libs_with_qt\build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release.
      -- The C compiler identification is MSVC 19.28.29912.0
      -- The CXX compiler identification is MSVC 19.28.29912.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
      -- Looking for pthread_create in pthreads
      -- Looking for pthread_create in pthreads - not found
      -- Looking for pthread_create in pthread
      -- Looking for pthread_create in pthread - not found
      -- Found Threads: TRUE  
      -- Performing Test HAVE_STDATOMIC
      -- Performing Test HAVE_STDATOMIC - Success
      -- Found WrapAtomic: TRUE  
      CMake Error at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtTargetHelpers.cmake:266 (add_library):
        add_library cannot create ALIAS target "Qt::QSQLiteAES2Plugin" because
        another target with the same name already exists.
      Call Stack (most recent call first):
        C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtPluginHelpers.cmake:153 (qt_internal_add_target_aliases)
        CMakeLists.txt:60 (qt_internal_add_plugin)
      
      
      CMake Error at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtAutogenHelpers.cmake:10 (set_directory_properties):
        set_directory_properties Wrong number of arguments
      Call Stack (most recent call first):
        C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtPluginHelpers.cmake:170 (qt_autogen_tools_initial_setup)
        CMakeLists.txt:60 (qt_internal_add_plugin)
      
      
      -- Configuring incomplete, errors occurred!
      See also "C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/CMakeFiles/CMakeOutput.log".
      See also "C:/devel/libs_with_qt/build-qsqlite-aes2-Desktop_Qt_6_5_1_MSVC2019_64bit-Release/CMakeFiles/CMakeError.log".
      CMake process exited with exit code 1.
      
      Elapsed time: 00:07.
      
      

      Can someone help me with this issue?

      Thanks in advance.

      Hans DijkemaH Offline
      Hans DijkemaH Offline
      Hans Dijkema
      wrote on last edited by
      #2

      @Hans-Dijkema

      Ok, it looks like the problem has been solved. I still need to test the newly created plugin with my program, but it looks like adding:

      set(PROJECT_VERSION "6.5.1")
      set(PROJECT_VERSION_MAJOR "6")
      set(PROJECT_VERSION_MINOR "5")
      set(PROJECT_VERSION_PATCH "1")
      

      solves my problem

      Hans DijkemaH 1 Reply Last reply
      1
      • Hans DijkemaH Hans Dijkema has marked this topic as solved on
      • Hans DijkemaH Hans Dijkema

        @Hans-Dijkema

        Ok, it looks like the problem has been solved. I still need to test the newly created plugin with my program, but it looks like adding:

        set(PROJECT_VERSION "6.5.1")
        set(PROJECT_VERSION_MAJOR "6")
        set(PROJECT_VERSION_MINOR "5")
        set(PROJECT_VERSION_PATCH "1")
        

        solves my problem

        Hans DijkemaH Offline
        Hans DijkemaH Offline
        Hans Dijkema
        wrote on last edited by
        #3

        @Hans-Dijkema

        Tested it with my application and it works again as expected.

        1 Reply Last reply
        1

        • Login

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