Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in Qt Creator 8.0.1 (with Qt 6.4) #52

Open
MammutReal opened this issue Oct 5, 2022 · 2 comments
Open

Problem in Qt Creator 8.0.1 (with Qt 6.4) #52

MammutReal opened this issue Oct 5, 2022 · 2 comments

Comments

@MammutReal
Copy link

Hi,

I try to use QArchive with CMake.

I created a new qt console test project and I copy-pasted almost everything from this page:
https://antonyjr.in/QArchive/docs/AddingQArchive.html

My root's CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
project(MyCoolApplication)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_subdirectory(libs)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)


add_executable(MyCoolApplication main.cpp)
target_link_libraries(MyCoolApplication PUBLIC Qt::Core)
target_link_libraries(MyCoolApplication PRIVATE QArchive)

My CMakeLists.txt in the libs folder:

CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
add_subdirectory(QArchive)

And as soon as I save the CMakeLists.txt, I get this error:
C:\Projects\MyCoolApplication\libs\QArchive\CMakeLists.txt:98: error: Target "QArchive" links to: LibArchive::LibArchive but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.

It has a problem with this line:
target_link_libraries(QArchive PUBLIC Qt${QT_VERSION_MAJOR}::Core LibArchive::LibArchive)

I'm very noob with packages so I don't really know what is the problem.

Can you look into it?

Thanks and Best Regards,
mammut

@antony-jr
Copy link
Owner

antony-jr commented Oct 6, 2022

@MammutReal QArchive depends on libarchive, have you installed that? You have to install along with all the dependencies of libarchive too.

See libarchive build instructions for Windows: https://github.com/libarchive/libarchive/wiki/BuildInstructions#building-on-windows

Windows is still a mess for software development for this reason. Consider learning Conan C++ Manager which might make life easy for you in Windows. Anyways I will try to give you a concise instruction for using QArchive in Windows later today.

If you were in Linux this would have been a piece of cake 😆

Reference: https://antonyjr.in/QArchive/docs/Installation.html

@MammutReal
Copy link
Author

MammutReal commented Oct 6, 2022

@antony-jr: oh, I didn't install it, sorry. I will look into those instructions, thanks for the link.

"Windows is still a mess for software development for this reason"

Yeah, I'm experiencing that right now. It was much easier with python, just created a venv, then pip install, and it was done.
But I have to learn the c++ way now. I'll look into the Conan c++ manager, too.

"Anyways I will try to give you a concise instruction for using QArchive in Windows later today."

Oh, that would be very kind of you, thank you in advance.

"If you were in Linux this would have been a piece of cake"

That's another thing I'll have to learn. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants