Skip to content

Commit

Permalink
Allow windows linking of test programs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattias Lindblad authored and Mattias Lindblad committed Apr 5, 2024
1 parent 7a6df81 commit 9a017a0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ target_link_libraries(example_kem PRIVATE ${TEST_DEPS})

add_executable(kat_kem kat_kem.c test_helpers.c)
target_link_libraries(kat_kem PRIVATE ${TEST_DEPS})
if(CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_SHARED_LIBS)
# workaround for Windows .dll cross-compiling
target_link_options(kat_kem PRIVATE -Wl,--allow-multiple-definition)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_SHARED_LIBS)
# workaround for Windows .dll
if(CMAKE_CROSSCOMPILING)
target_link_options(kat_kem PRIVATE -Wl,--allow-multiple-definition)
else()
target_link_options(kat_kem PRIVATE "/FORCE:MULTIPLE")
endif()
endif()

add_executable(test_kem test_kem.c)
Expand All @@ -86,9 +90,13 @@ target_link_libraries(example_sig PRIVATE ${TEST_DEPS})

add_executable(kat_sig kat_sig.c test_helpers.c)
target_link_libraries(kat_sig PRIVATE ${TEST_DEPS})
if(CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_SHARED_LIBS)
# workaround for Windows .dll cross-compiling
target_link_options(kat_sig PRIVATE -Wl,--allow-multiple-definition)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_SHARED_LIBS)
# workaround for Windows .dll
if(CMAKE_CROSSCOMPILING)
target_link_options(kat_sig PRIVATE -Wl,--allow-multiple-definition)
else()
target_link_options(kat_sig PRIVATE "/FORCE:MULTIPLE")
endif()
endif()

add_executable(test_sig test_sig.c)
Expand Down

0 comments on commit 9a017a0

Please sign in to comment.