From ad446d96d3f9425de457f28a42f461ddc104a4b7 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sun, 21 May 2023 23:20:41 +0100 Subject: 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 --- src/CMakeLists.txt | 9 ++------ src/cmocka.def | 62 ------------------------------------------------------ 2 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 src/cmocka.def diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a107bdd..fac4365 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/cmocka.def b/src/cmocka.def deleted file mode 100644 index 565f8a9..0000000 --- a/src/cmocka.def +++ /dev/null @@ -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 -- cgit v1.1