cmake setup problem
Closed this issue · 4 comments
Hi,
I tried all 3 ways to use QXlsx in my project. After building, I put the QXlsx folder inside the project's root directory.
1. I added 2 lines to CMakeLists.txt
`find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Widgets Sql QXlsxQt6)
target_link_libraries(myApp
PRIVATE Qt6::Quick Qt6::Widgets Qt6::Sql QXlsx::QXlsx
)`
and the result is:
"/CMakeLists.txt:7: błąd: Found package configuration file: .../Qt/6.5.2/gcc_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find required Qt component "QXlsxQt6". Expected Config file at "/Qt/6.5.2/gcc_64/lib/cmake/Qt6QXlsxQt6/Qt6QXlsxQt6Config.cmake" does NOT exist"
2. I tried also this
`add_subdirectory(QXlsx)
target_link_libraries(myApp
PRIVATE Qt6::Quick Qt6::Widgets Qt6::Sql QXlsx::QXlsx
)`
and the result
"/usr/share/cmake/Modules/CPack.cmake:685: błąd: CPack readme resource file: "/QXlsx/../README.md" could not be found. /usr/share/cmake/Modules/CPack.cmake:691 (cpack_check_file_exists) QXlsx/cmake/modules/CPackConfig.cmake:21 (include) QXlsx/CMakeLists.txt:220 (include)"
3. and the last way
`include(FetchContent)
FetchContent_Declare(
QXlsx
GIT_REPOSITORY https://github.com/QtExcel/QXlsx.git
GIT_TAG sha-of-the-commit
SOURCE_SUBDIR QXlsx
)
FetchContent_MakeAvailable(QXlsx)
target_link_libraries(myApp
PRIVATE Qt6::Quick Qt6::Widgets Qt6::Sql QXlsx::QXlsx
)`
and this time I received
"/qxlsx-subbuild/qxlsx-populate-prefix/tmp/qxlsx-populate-gitclone.cmake:49: błąd: Failed to checkout tag: 'sha-of-the-commit'"
Any help?
Did anybody manage to use QXlsx for cmake? I used it previously for qmake without any problems on the same Linux installation, but I switched to cmake as the newest versions of the Qt Creator don't use qmake.
you need to replace the 'sha-of-the-commit'
you need to replace the 'sha-of-the-commit'
Replace by what?
@dantti , I was ignorant. Thank you for your help. I replaced it with the latest tag, and it works.
Thank you 😊