summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlois Klink <alois@aloisklink.com>2023-05-21 23:20:41 +0100
committerAndreas Schneider <asn@cryptomilk.org>2023-08-01 10:58:03 +0200
commitad446d96d3f9425de457f28a42f461ddc104a4b7 (patch)
tree7d877cadae46d55b468b0b0092384946b4ae1b1f
parent1442e464463f9dd740ccb91de0d9bcff0cefd31b (diff)
downloadcmocka-ad446d96d3f9425de457f28a42f461ddc104a4b7.zip
cmocka-ad446d96d3f9425de457f28a42f461ddc104a4b7.tar.gz
cmocka-ad446d96d3f9425de457f28a42f461ddc104a4b7.tar.bz2
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>
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/cmocka.def62
2 files changed, 2 insertions, 69 deletions
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