Pass library as a part of -Wl argument in external_jemalloc
Or cmake can place the arguments in random order
This commit is contained in:
parent
b6515c543a
commit
0e6f53ced4
1 changed files with 14 additions and 20 deletions
34
external/jemalloc/CMakeLists.txt
vendored
34
external/jemalloc/CMakeLists.txt
vendored
|
|
@ -13,22 +13,23 @@ endif()
|
|||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(JEMALLOC IMPORTED_TARGET jemalloc)
|
||||
pkg_check_modules(JEMALLOC jemalloc)
|
||||
|
||||
if (JEMALLOC_FOUND)
|
||||
target_link_libraries(external_jemalloc
|
||||
target_include_directories(external_jemalloc SYSTEM
|
||||
INTERFACE
|
||||
-Wl,--push-state,--no-as-needed
|
||||
PkgConfig::JEMALLOC
|
||||
${JEMALLOC_LINK_LIBRARIES}
|
||||
-Wl,--pop-state
|
||||
${JEMALLOC_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_options(external_jemalloc
|
||||
INTERFACE
|
||||
-Wl,--push-state,--no-as-needed,${JEMALLOC_LINK_LIBRARIES},--pop-state
|
||||
)
|
||||
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(external_jemalloc_bundled STATIC IMPORTED)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(jemalloc
|
||||
URL ${third_party_loc}/jemalloc
|
||||
|
|
@ -42,21 +43,14 @@ ExternalProject_Add(jemalloc
|
|||
ExternalProject_Get_property(jemalloc SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
|
||||
set_target_properties(external_jemalloc_bundled PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libjemalloc.a"
|
||||
)
|
||||
|
||||
target_include_directories(external_jemalloc_bundled SYSTEM
|
||||
target_include_directories(external_jemalloc SYSTEM
|
||||
INTERFACE
|
||||
${SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
add_dependencies(external_jemalloc_bundled jemalloc-build)
|
||||
|
||||
target_link_libraries(external_jemalloc
|
||||
target_link_options(external_jemalloc
|
||||
INTERFACE
|
||||
-Wl,--push-state,--whole-archive
|
||||
$<TARGET_FILE:external_jemalloc_bundled>
|
||||
-Wl,--pop-state
|
||||
external_jemalloc_bundled
|
||||
-Wl,--push-state,--whole-archive,${SOURCE_DIR}/lib/libjemalloc.a,--pop-state
|
||||
)
|
||||
|
||||
add_dependencies(external_jemalloc jemalloc-build)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue