mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-01-14 00:27:59 +08:00
Add NO_SYSTEM_ENVIRONMENT_PATH and example of linking with the object file; pr #67
This commit is contained in:
parent
56bdb2c2f3
commit
fc35f6069a
@ -162,6 +162,8 @@ target_include_directories(mimalloc-obj PUBLIC
|
||||
$<INSTALL_INTERFACE:${mi_install_dir}/include>
|
||||
)
|
||||
|
||||
install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_dir})
|
||||
|
||||
install(FILES $<TARGET_OBJECTS:mimalloc-obj>
|
||||
DESTINATION ${mi_install_dir}
|
||||
RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} )
|
||||
|
@ -13,17 +13,25 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
# Import mimalloc (if installed)
|
||||
find_package(mimalloc 1.0 REQUIRED)
|
||||
find_package(mimalloc 1.0 REQUIRED NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
|
||||
message(STATUS "${MIMALLOC_INCLUDE_DIR}")
|
||||
|
||||
# Tests
|
||||
add_executable(static-override main-override.c)
|
||||
target_link_libraries(static-override PUBLIC mimalloc-static)
|
||||
|
||||
add_executable(static-override-cxx main-override.cpp)
|
||||
target_link_libraries(static-override-cxx PUBLIC mimalloc-static)
|
||||
|
||||
add_executable(dynamic-override main-override.c)
|
||||
target_link_libraries(dynamic-override PUBLIC mimalloc)
|
||||
|
||||
add_executable(dynamic-override-cxx main-override.cpp)
|
||||
target_link_libraries(dynamic-override-cxx PUBLIC mimalloc)
|
||||
|
||||
# with a static library
|
||||
add_executable(static-override main-override.c)
|
||||
target_link_libraries(static-override PUBLIC mimalloc-static)
|
||||
|
||||
add_executable(static-override-cxx main-override.cpp)
|
||||
target_link_libraries(static-override-cxx PUBLIC mimalloc-static)
|
||||
|
||||
# and with a static object file; need to link with pthread explicitly :-(
|
||||
add_executable(static-override-obj main-override.c $<TARGET_OBJECTS:mimalloc-obj>)
|
||||
target_include_directories(static-override-obj PUBLIC $<TARGET_PROPERTY:mimalloc-obj,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_link_libraries(static-override-obj PUBLIC pthread)
|
||||
|
Loading…
x
Reference in New Issue
Block a user