mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
cmake: add pkg-config file
pkg-config allows using the library in build systems that are not cmake, by exporting the same information from the cmake -config files in a buildsystem-neutral format. Fixes #16
This commit is contained in:
parent
eb29d6b06f
commit
eb97236652
3 changed files with 48 additions and 1 deletions
|
@ -217,18 +217,22 @@ endif()
|
|||
# extra needed libraries
|
||||
if(WIN32)
|
||||
list(APPEND mi_libraries psapi shell32 user32 advapi32 bcrypt)
|
||||
set(pc_libraries "-lpsapi -lshell32 -luser32 -ladvapi32 -lbcrypt")
|
||||
else()
|
||||
find_library(MI_LIBPTHREAD pthread)
|
||||
if (MI_LIBPTHREAD)
|
||||
list(APPEND mi_libraries ${MI_LIBPTHREAD})
|
||||
set(pc_libraries "-pthread")
|
||||
endif()
|
||||
find_library(MI_LIBRT rt)
|
||||
if(MI_LIBRT)
|
||||
list(APPEND mi_libraries ${MI_LIBRT})
|
||||
endif()
|
||||
set(pc_libraries "${pc_libraries} -lrt")
|
||||
endif()
|
||||
find_library(MI_LIBATOMIC atomic)
|
||||
if (MI_LIBATOMIC OR MI_USE_LIBATOMIC)
|
||||
list(APPEND mi_libraries atomic)
|
||||
set(pc_libraries "${pc_libraries} -latomic")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -376,6 +380,15 @@ if (MI_BUILD_OBJECT)
|
|||
RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} )
|
||||
endif()
|
||||
|
||||
# pkg-config file support
|
||||
include("cmake/JoinPaths.cmake")
|
||||
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
join_paths(libdir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
configure_file(mimalloc.pc.in mimalloc.pc @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mimalloc.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# API surface testing
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue