Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cpack fail for library depending on qtmqtt COMPONENT on windows
Qt 6.12 LTS is out! See what's new in the release blog

Cpack fail for library depending on qtmqtt COMPONENT on windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 342 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.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by Mesrine
    #1

    Hi everyone,

    I have a cmake project that build a library that depends on Qt Components like Qt6::WebSockets and Qt6::Mqtt .

    So the important part of the root cmake is like:

    find_package(Qt6 COMPONENTS Core OPTIONAL_COMPONENTS WebSockets Mqtt)
    
    
    if (Qt6_FOUND)
    	qt_standard_project_setup()
    	if(NOT TARGET Qt6::WebSockets)
    		FetchContent_Declare(
    			qtwebsockets
    			GIT_REPOSITORY git://code.qt.io/qt/qtwebsockets.git
    			GIT_TAG 6.5.0
    			)
    		FetchContent_MakeAvailable(qtwebsockets)
    	endif()
    	if(NOT TARGET Qt6::Mqtt)
    		FetchContent_Declare(
    			qtmqtt
    			GIT_REPOSITORY git://code.qt.io/qt/qtmqtt.git
    			GIT_TAG 6.5.0
    			)
    		FetchContent_MakeAvailable(qtmqtt)
    	endif()
    
    endif(Qt6_FOUND)
    
    add_library(qclientMQTT include/client/qclientMQTT.hpp qclientMQTT.cpp src/qwebsocketiodevice.cpp include/client/qwebsocketiodevice.hpp)
    
    ...
    
    if (Qt6_FOUND)
    	target_link_libraries(qclientMQTT PUBLIC  Qt6::Core Qt6::Mqtt )
    	target_link_libraries(qclientMQTT PRIVATE  Qt6::WebSockets)
    endif(Qt6_FOUND)
    

    So if it does not find the OPTIONAL_COMPONENTS WebSockets Mqtt, it will download them and built them.

    The library compiles well for Windows, Macos and Linux.
    I also create packages of the library by using CPack like:

    cpack -B package --config CPackConfig.cmake
    

    This works well for macos and linux returning(for linux):

    CPack: Create package using STGZ
    CPack: Install projects
    CPack: - Install project: QtIotaClient []
    CPack: Create package
    CPack: - package: /home/runner/work/_temp/build/package/QtIotaClient-v0.1.1-Linux_5.15.0-1039-azure-x86_64-GNU.sh generated.
    CPack: Create package using TGZ
    CPack: Install projects
    CPack: - Install project: QtIotaClient []
    CPack: Create package
    CPack: - package: /home/runner/work/_temp/build/package/QtIotaClient-v0.1.1-Linux_5.15.0-1039-azure-x86_64-GNU.tar.gz generated.
    CPack: Create package using TZ
    CPack: Install projects
    CPack: - Install project: QtIotaClient []
    CPack: Create package
    CPack: - package: /home/runner/work/_temp/build/package/QtIotaClient-v0.1.1-Linux_5.15.0-1039-azure-x86_64-GNU.tar.Z generated.
    
    

    but for windows it returns:

    CPack: Create package using NSIS
    CPack: Install projects
    CPack: - Install project: QtIotaClient []
    CPack: -   Install component: Devel
    CPack: -   Install component: Unspecified
    CPack: -   Install component: _install_html_docs_Mqtt
    CMake Error at D:/a/_temp/build/_deps/qtmqtt-build/src/mqtt/cmake_install.cmake:118 (file):
      file INSTALL cannot find "D:/a/_temp/build/./doc/qtmqtt": File exists.
    Call Stack (most recent call first):
      D:/a/_temp/build/_deps/qtmqtt-build/src/cmake_install.cmake:42 (include)
      D:/a/_temp/build/_deps/qtmqtt-build/cmake_install.cmake:42 (include)
      D:/a/_temp/build/cmake_install.cmake:81 (include)
    
    
    CPack Error: Error when generating package: QtIotaClient
    

    So for windows it is trying to install the documentation of the COMPONENT and other things and fails.

    I would like that the COMPONENT library get packaged also and my library packaging finish. Any help on the later will be much appreciated.

    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
    • Unsolved