From a48ebeb361f114d3a89ee68719aebbf6df20d3f4 Mon Sep 17 00:00:00 2001 From: tmathern <60901087+tmathern@users.noreply.github.com> Date: Tue, 17 Feb 2026 23:42:36 -0800 Subject: [PATCH 1/2] fix: Update CMakeLists.txt --- src/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0091770..3efc6571 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,6 +224,14 @@ add_custom_command( # Define the C++ library using the generated unity source (one TU). add_library(c2pa_cpp SHARED "${C2PA_AMALGAM_OUTPUT}") +# FIX 1: On Windows, export all symbols so MSVC generates the c2pa_cpp.lib +# import library that test/example targets need to link against. +# Without this, MSVC silently skips .lib generation when no __declspec(dllexport) +# annotations are present, causing LNK1104 at link time. +if(WIN32) + set_target_properties(c2pa_cpp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + # Set compiler-specific flags for the C++ library if(MSVC) target_compile_options(c2pa_cpp PRIVATE @@ -253,7 +261,10 @@ else() target_link_options(c2pa_cpp PRIVATE -Wl,-bind_at_load ) - else() + elseif(UNIX) + # FIX 2: These are Linux ELF-only hardening flags. Guard them so they + # are not passed to MinGW's ld.exe on Windows, which targets PE/COFF + # and does not recognise the -z option, causing a link failure. target_link_options(c2pa_cpp PRIVATE -Wl,-z,relro -Wl,-z,now From f5cd57e82b73e5d9cea53ef89f244ea1484ddf4a Mon Sep 17 00:00:00 2001 From: tmathern <60901087+tmathern@users.noreply.github.com> Date: Tue, 17 Feb 2026 23:45:47 -0800 Subject: [PATCH 2/2] Update CMakeLists.txt --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3efc6571..714d7758 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,7 +224,7 @@ add_custom_command( # Define the C++ library using the generated unity source (one TU). add_library(c2pa_cpp SHARED "${C2PA_AMALGAM_OUTPUT}") -# FIX 1: On Windows, export all symbols so MSVC generates the c2pa_cpp.lib +# On Windows, export all symbols so MSVC generates the c2pa_cpp.lib # import library that test/example targets need to link against. # Without this, MSVC silently skips .lib generation when no __declspec(dllexport) # annotations are present, causing LNK1104 at link time. @@ -262,9 +262,7 @@ else() -Wl,-bind_at_load ) elseif(UNIX) - # FIX 2: These are Linux ELF-only hardening flags. Guard them so they - # are not passed to MinGW's ld.exe on Windows, which targets PE/COFF - # and does not recognise the -z option, causing a link failure. + # Linux-only hardening flags target_link_options(c2pa_cpp PRIVATE -Wl,-z,relro -Wl,-z,now