Cpack fail for library depending on qtmqtt COMPONENT on windows
-
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.