fix cmake issues with OBJECT install

This commit is contained in:
daan 2019-07-09 11:32:24 -07:00
parent 76023ca45f
commit cf8815854c
3 changed files with 6 additions and 4 deletions

View File

@ -162,7 +162,8 @@ target_include_directories(mimalloc-obj PUBLIC
$<INSTALL_INTERFACE:${mi_install_dir}/include>
)
install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_dir})
# seems to lead to cmake warnings/errors on some systems, disable for now :-(
# install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_dir})
install(FILES $<TARGET_OBJECTS:mimalloc-obj>
DESTINATION ${mi_install_dir}

View File

@ -1 +1,2 @@
include(${CMAKE_CURRENT_LIST_DIR}/mimalloc.cmake)
get_filename_component(MIMALLOC_TARGET_DIR "${CMAKE_CURRENT_LIST_DIR}" PATH)

View File

@ -31,7 +31,7 @@ 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>)
# and with a static object file
add_executable(static-override-obj main-override.c ${MIMALLOC_TARGET_DIR}/mimalloc.o)
target_include_directories(static-override-obj PUBLIC ${MIMALLOC_TARGET_DIR}/include)
target_link_libraries(static-override-obj PUBLIC pthread)