mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-19 05:29:32 +03:00
Added cmake MI_BUILD_TESTS flag to turn on/off building of test projects and unit tests.
This commit is contained in:
parent
eb25093b13
commit
7343a7ae1b
1 changed files with 22 additions and 19 deletions
|
@ -10,6 +10,7 @@ option(MI_SEE_ASM "Generate assembly files" OFF)
|
||||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode" OFF)
|
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode" OFF)
|
||||||
option(MI_USE_CXX "Use the C++ compiler to compile the library" OFF)
|
option(MI_USE_CXX "Use the C++ compiler to compile the library" OFF)
|
||||||
option(MI_SECURE "Use security mitigations (like guard pages and randomization)" OFF)
|
option(MI_SECURE "Use security mitigations (like guard pages and randomization)" OFF)
|
||||||
|
option(MI_BUILD_TESTS "Enable test projects and unit tests" OFF)
|
||||||
|
|
||||||
set(mi_install_dir "lib/mimalloc-${mi_version}")
|
set(mi_install_dir "lib/mimalloc-${mi_version}")
|
||||||
|
|
||||||
|
@ -187,6 +188,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/mimalloc-obj.dir/src/static
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# API surface testing
|
# API surface testing
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
if(MI_BUILD_TESTS)
|
||||||
add_executable(mimalloc-test-api test/test-api.c)
|
add_executable(mimalloc-test-api test/test-api.c)
|
||||||
target_compile_definitions(mimalloc-test-api PRIVATE ${mi_defines})
|
target_compile_definitions(mimalloc-test-api PRIVATE ${mi_defines})
|
||||||
target_compile_options(mimalloc-test-api PRIVATE ${mi_cflags})
|
target_compile_options(mimalloc-test-api PRIVATE ${mi_cflags})
|
||||||
|
@ -202,6 +204,7 @@ target_link_libraries(mimalloc-test-stress PRIVATE mimalloc-static)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(test_api, mimalloc-test-api)
|
add_test(test_api, mimalloc-test-api)
|
||||||
add_test(test_stress, mimalloc-test-stress)
|
add_test(test_stress, mimalloc-test-stress)
|
||||||
|
endif()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Set override properties
|
# Set override properties
|
||||||
|
|
Loading…
Add table
Reference in a new issue