Skip to content

Commit 143cf9c

Browse files
authored
Merge pull request #400 from mkurdej/redirect32
[Windows] Correctly choose 32-bit version of mimalloc-redirect{,32}.dll in CMake.
2 parents a732b76 + acba250 commit 143cf9c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,16 @@ if(MI_BUILD_SHARED)
265265
)
266266
if(WIN32)
267267
# On windows copy the mimalloc redirection dll too.
268-
target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect.lib)
268+
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
269+
set(MIMALLOC_REDIRECT_SUFFIX "32")
270+
else()
271+
set(MIMALLOC_REDIRECT_SUFFIX "")
272+
endif()
273+
274+
target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.lib)
269275
add_custom_command(TARGET mimalloc POST_BUILD
270-
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect.dll" $<TARGET_FILE_DIR:mimalloc>
271-
COMMENT "Copy mimalloc-redirect.dll to output directory")
276+
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" $<TARGET_FILE_DIR:mimalloc>
277+
COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory")
272278
endif()
273279

274280
if (MI_INSTALL_TOPLEVEL MATCHES "ON")

0 commit comments

Comments
 (0)