Results 1 to 3 of 3

Thread: CMake + QtSingleApplication as thirparty static lib

  1. #1
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default CMake + QtSingleApplication as thirparty static lib

    Hi, I want to use QtSingleApplication in my application. I decided to use it as a thirdparty static library, apart from my own code. In the folder containing QtSingleApplication .h/.cpp files I created the following CMakeLists.txt:

    Qt Code:
    1. PROJECT(qtsingleapplication)
    2. cmake_minimum_required(VERSION 2.8)
    3.  
    4. SET( qtsingleapplicationSources
    5. qtlocalpeer.cpp
    6. qtlockedfile.cpp
    7. qtlockedfile_unix.cpp
    8. qtlockedfile_win.cpp
    9. qtsingleapplication.cpp
    10. qtsinglecoreapplication.cpp
    11. )
    12.  
    13. INCLUDE_DIRECTORIES(${QT_INCLUDES}
    14. ${CMAKE_CURRENT_BINARY_DIR}
    15. ${CMAKE_CURRENT_SOURCE_DIR})
    16.  
    17. ADD_LIBRARY( myapp_qtsingleapplication STATIC ${qtsingleapplicationSources} )
    18. TARGET_LINK_LIBRARIES( myapp_qtsingleapplication ${QT_QTNETWORK_LIBRARY})
    To copy to clipboard, switch view to plain text mode 

    Unfortunately make fails with the following error:

    myapp/thirdparty/QtSingleApplication/qtlockedfile.cpp:83:1: error: ‘QtLockedFile’ does not name a type
    I can't understand the reason of the error; qtlockedfile.h is in place.

    Can you help me?

    Very thanks.
    Giuseppe CalÃ

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: CMake + QtSingleApplication as thirparty static lib

    The error message comes from your compiler (make is functioning correctly). It is the result of not correctly converting what the src/qtsingleapplication.pri does into your CMakeLists.txt. QtSingleApplication pri file builds using only sources qtsingleapplication.cpp and qtlocalpeer.cpp.
    Qt Code:
    1. PROJECT(qtsingleapplication)
    2. cmake_minimum_required(VERSION 2.8)
    3. FIND_PACKAGE(Qt4 REQUIRED)
    4.  
    5. SET( qtsingleapplicationSources
    6. qtlocalpeer.cpp
    7. qtsingleapplication.cpp
    8. )
    9.  
    10. INCLUDE_DIRECTORIES(${QT_INCLUDES}
    11. ${CMAKE_CURRENT_BINARY_DIR}
    12. ${CMAKE_CURRENT_SOURCE_DIR})
    13.  
    14. ADD_LIBRARY( myapp_qtsingleapplication STATIC ${qtsingleapplicationSources} )
    15. TARGET_LINK_LIBRARIES( myapp_qtsingleapplication ${QT_QTNETWORK_LIBRARY})
    To copy to clipboard, switch view to plain text mode 
    Unusually, qtlocalpeer.cpp includes the qtlockedfile*.cpp files directly.

  3. The following user says thank you to ChrisW67 for this useful post:

    jiveaxe (30th December 2013)

  4. #3
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: CMake + QtSingleApplication as thirparty static lib

    Thanks. You were right!
    Giuseppe CalÃ

Similar Threads

  1. QtSingleApplication on Windows
    By RafalNiewinski in forum Qt Programming
    Replies: 4
    Last Post: 20th August 2013, 09:11
  2. QtSingleApplication, QtService and Qt5
    By mentalmushroom in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2012, 15:20
  3. Problem building QtSingleApplication
    By skuallpa in forum Installation and Deployment
    Replies: 0
    Last Post: 28th April 2010, 16:20
  4. QtSingleApplication and Qr 4.2.1
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2006, 11:41
  5. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 20:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.