cmake: enable WINDOWS_EXPORT_ALL_SYMBOLS

Enable the [`WINDOWS_EXPORT_ALL_SYMBOLS` CMake property][1],
which automatically exports all symbols into the `.dll` file.

This feature is available since [CMake 3.4][2], which is fine,
since the minimum version of CMake CMocka supports is CMake 3.5.

It is a bit slower, but it does mean that we no longer need to
manually create a `.def` file, as CMake will automatically create one
for us.

[1]: https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html
[2]: https://www.kitware.com//create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/

Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Alois Klink 2023-05-21 23:20:41 +01:00 committed by Andreas Schneider
parent 1442e46446
commit ad446d96d3
2 changed files with 2 additions and 69 deletions

View File

@ -12,13 +12,6 @@ set(cmocka_SRCS
cmocka.c
)
if (WIN32)
set(cmocka_SRCS
${cmocka_SRCS}
cmocka.def
)
endif (WIN32)
add_library(cmocka ${cmocka_SRCS})
target_include_directories(cmocka
@ -59,6 +52,8 @@ set_target_properties(cmocka PROPERTIES
C_STANDARD_REQUIRED ON
# cmocka uses POSIX-2008 C extensions
C_EXTENSIONS ON
# automatically export all global objects into DLL on Windows
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
add_library(cmocka::cmocka ALIAS cmocka)

View File

@ -1,62 +0,0 @@
LIBRARY cmocka
EXPORTS
_assert_double_equal
_assert_double_not_equal
_assert_float_equal
_assert_float_not_equal
_assert_int_equal
_assert_int_in_range
_assert_int_in_set
_assert_int_not_equal
_assert_int_not_in_range
_assert_int_not_in_set
_assert_memory_equal
_assert_memory_not_equal
_assert_not_in_set
_assert_return_code
_assert_string_equal
_assert_string_not_equal
_assert_true
_assert_uint_equal
_assert_uint_in_range
_assert_uint_in_set
_assert_uint_not_equal
_assert_uint_not_in_range
_assert_uint_not_in_set
_check_expected
_cmocka_run_group_tests
_expect_any
_expect_check
_expect_function_call
_expect_in_range
_expect_in_set
_expect_memory
_expect_not_in_range
_expect_not_in_set
_expect_not_memory
_expect_not_string
_expect_not_value
_expect_string
_expect_value
_fail
_function_called
_mock
_skip
_stop
_test_calloc
_test_free
_test_malloc
_test_realloc
_will_return
cmocka_print_error
cmocka_set_message_output
cmocka_set_test_filter
cmocka_set_skip_filter
global_expect_assert_env DATA
global_expecting_assert DATA
global_last_failed_assert DATA
mock_assert
print_error
print_message
vprint_error
vprint_message