diff --git a/examples/szip/CMakeLists.txt b/examples/szip/CMakeLists.txt index 447c71d152..c5a5b0a91b 100644 --- a/examples/szip/CMakeLists.txt +++ b/examples/szip/CMakeLists.txt @@ -14,4 +14,4 @@ hunter_add_package(szip) find_package(szip REQUIRED) add_executable(foo foo.cpp) -target_link_libraries(foo szip::szip) +target_link_libraries(foo PRIVATE szip::szip) diff --git a/examples/szip/foo.cpp b/examples/szip/foo.cpp index aa5926a073..0785793f85 100644 --- a/examples/szip/foo.cpp +++ b/examples/szip/foo.cpp @@ -1,6 +1,14 @@ +#include // szlib.h uses size_t, but doesn't include stddef.h, workaround that +extern "C" { +// szlib.h is a C-library, but the header doesn't handle C++, so do it for the lib +// otherwise the functions (for example SZ_encoder_enabled()) will not be found #include +} +#include int main() { + std::cout << "SZLIB_VERSION: " << SZLIB_VERSION << std::endl; + std::cout << "SZ_encoder_eabled: " << SZ_encoder_enabled() << std::endl; return 0; -} \ No newline at end of file +}