Skip to content

Instantly share code, notes, and snippets.

@bsergean
Created January 27, 2022 17:47
Show Gist options
  • Save bsergean/1cb658e6280a578af5bef1c26d9f7dd3 to your computer and use it in GitHub Desktop.
Save bsergean/1cb658e6280a578af5bef1c26d9f7dd3 to your computer and use it in GitHub Desktop.
Testing consuming libdeflate CMake with FetchContent
project(my_exe)
cmake_minimum_required(VERSION 3.20)
include(FetchContent)
FetchContent_Declare(libdeflate
GIT_REPOSITORY "https://github.com/SpaceIm/libdeflate"
GIT_TAG "cmakelists" # Or an explicit tag
GIT_SHALLOW 1)
FetchContent_MakeAvailable(libdeflate)
add_executable(my_exe main.cpp)
target_link_libraries(my_exe libdeflate)
#include <iostream>
#include <libdeflate.h>
int main()
{
int compressionLevel = 6; // equivalent to the zlib default compression
struct libdeflate_compressor * compressor = libdeflate_alloc_compressor( compressionLevel );
std::cout << "hello world" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment