LalaWootwoot
LalaWootwoot

Reputation: 51

LibArchive: Build/link in existing C++ project with CMake Fetch Dependencies and without tests

I'm trying to add LibArchive to my project but it keeps including the tests and it also fails to link. Its possible that I have problems with the way I set up the cmake file?

Notes: I can't assume that libarchive is already present on the system, so I'm using fetch content to ensure that it is always present. Fetch content does populate the files on my system as expected. Some tests are being skipped in the build process, but others are not.

In my CMake files, I have:

# Have to set these to get it to compile on windows:
set(HAVE_WCSCPY ON)
#...a few more, too.

# Disable Tests:
set(ENABLE_TEST OFF)

FetchContent_Declare(libarchive
GIT_REPOSITORY https://github.com/libarchive/libarchive/
GIT_TAG v3.7.4)

FetchContent_MakeAvailable(libarchive)

target_link_library(myLib PRIVATE libarchive)

I'm expecting this to compile and link properly. I would also not expect to need to set HAVE_WCSCPY or any of the others on windows.

I'm seeing many tests still getting built and the library not linking properly. The build time is also extraordinary as it appears to running a number of tests.

Upvotes: 0

Views: 239

Answers (0)

Related Questions