From cf8815854cb0eff64394ef324a2f693d15dab91a Mon Sep 17 00:00:00 2001 From: daan Date: Tue, 9 Jul 2019 11:32:24 -0700 Subject: [PATCH] fix cmake issues with OBJECT install --- CMakeLists.txt | 3 ++- cmake/mimalloc-config.cmake | 1 + test/CMakeLists.txt | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88734360..d6216384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,8 @@ target_include_directories(mimalloc-obj PUBLIC $ ) -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 $ DESTINATION ${mi_install_dir} diff --git a/cmake/mimalloc-config.cmake b/cmake/mimalloc-config.cmake index b7ced994..12da076e 100644 --- a/cmake/mimalloc-config.cmake +++ b/cmake/mimalloc-config.cmake @@ -1 +1,2 @@ include(${CMAKE_CURRENT_LIST_DIR}/mimalloc.cmake) +get_filename_component(MIMALLOC_TARGET_DIR "${CMAKE_CURRENT_LIST_DIR}" PATH) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a9efaff9..42d4a2f4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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_include_directories(static-override-obj PUBLIC $) +# 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)