diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index 6797fd43..85cdff45 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -455,12 +455,8 @@ target_include_directories(expat $ ) -if(WIN32) - if(EXPAT_SHARED_LIBS) - target_compile_definitions(expat PRIVATE VER_FILEVERSION=${_EXPAT_DLL_VERSION}) - else() - target_compile_definitions(expat PUBLIC -DXML_STATIC) - endif() +if(WIN32 AND EXPAT_SHARED_LIBS) + target_compile_definitions(expat PRIVATE VER_FILEVERSION=${_EXPAT_DLL_VERSION}) endif() expat_install(TARGETS expat EXPORT expat @@ -594,25 +590,27 @@ if(EXPAT_BUILD_TESTS) endif() endfunction() - add_executable(runtests tests/runtests.c ${test_SRCS}) - set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) - expat_add_test(runtests $) - + set(_EXPAT_TEST_TARGETS runtests runtestspp) + add_executable(runtests tests/runtests.c ${test_SRCS}) add_executable(runtestspp tests/runtestspp.cpp ${test_SRCS}) - set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) - expat_add_test(runtestspp $) - if(_EXPAT_LIBM_FOUND) - target_link_libraries(runtests m) - target_link_libraries(runtestspp m) - endif() + foreach(_target ${_EXPAT_TEST_TARGETS}) + set_property(TARGET ${_target} PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) + expat_add_test(${_target} $) - if(EXPAT_WITH_LIBBSD) - target_link_libraries(runtests ${LIB_BSD}) - target_link_libraries(runtestspp ${LIB_BSD}) - endif() + if(_EXPAT_LIBM_FOUND) + target_link_libraries(${_target} m) + endif() + + if(EXPAT_WITH_LIBBSD) + target_link_libraries(${_target} ${LIB_BSD}) + endif() + endforeach() endif() +# +# Fuzzers +# if(EXPAT_BUILD_FUZZERS) if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") message(SEND_ERROR @@ -680,6 +678,23 @@ else() endif() endif() +# +# C/C++ config affecting multiple targets +# +if(WIN32) + set(_EXPAT_STATIC_TARGETS ${_EXPAT_TEST_TARGETS}) + if(NOT EXPAT_SHARED_LIBS) + list(APPEND _EXPAT_STATIC_TARGETS expat) + endif() + if(EXPAT_BUILD_FUZZERS) + list(APPEND _EXPAT_STATIC_TARGETS fuzzpat) + endif() + + foreach(_target ${_EXPAT_STATIC_TARGETS}) + target_compile_definitions(${_target} PUBLIC -DXML_STATIC) + endforeach() +endif() + # # Custom target "run-xmltest" # diff --git a/expat/Changes b/expat/Changes index 3366fef7..1b8244cb 100644 --- a/expat/Changes +++ b/expat/Changes @@ -3,6 +3,10 @@ NOTE: We are looking for help with a few things: If you can help, please get in touch. Thanks! Release x.x.x xxx xxxxx xx xxxx + Other changes: + #597 #599 Windows|CMake: Add missing -DXML_STATIC to test runners + and fuzzers + Infrastructure: #597 #598 CI: Windows: Start covering MSVC 2022