From 3ca8fe7e6cadc837d9e5d27f5038ab1a7324a0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 27 Jan 2015 23:31:14 +0100 Subject: [PATCH] TgaImageConverter, TgaImporter: fix linking of tests on Windows. Dllimport hell at its finest. --- src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt | 8 ++++++++ src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt index 6a8416d68..3a471c284 100644 --- a/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt @@ -29,3 +29,11 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TgaImageConverterTest TgaImageConverterTest.cpp LIBRARIES MagnumTgaImageConverterTestLib MagnumTgaImporterTestLib) +# On Win32 we need to avoid dllimporting TgaImporter and TgaImageConverterTest +# symbols, because it would search for the symbols in some DLL even when they +# were linked statically. However it apparently doesn't matter that they were +# dllexported when building the static library. EH. +if(WIN32) + set_target_properties(TgaImageConverterTest PROPERTIES COMPILE_FLAGS + "-DMAGNUM_TGAIMAGECONVERTER_BUILD_STATIC -DMAGNUM_TGAIMPORTER_BUILD_STATIC") +endif() diff --git a/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt index 94e79f647..51f20b106 100644 --- a/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt @@ -29,3 +29,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TgaImporterTest TgaImporterTest.cpp LIBRARIES MagnumTgaImporterTestLib) +# On Win32 we need to avoid dllimporting TgaImporter symbols, because it would +# search for the symbols in some DLL even when they were linked statically. +# However it apparently doesn't matter that they were dllexported when building +# the static library. EH. +if(WIN32) + set_target_properties(TgaImporterTest PROPERTIES COMPILE_FLAGS "-DMAGNUM_TGAIMPORTER_BUILD_STATIC") +endif()