Created
January 27, 2022 17:47
-
-
Save bsergean/1cb658e6280a578af5bef1c26d9f7dd3 to your computer and use it in GitHub Desktop.
Testing consuming libdeflate CMake with FetchContent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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