From 6df0b1190361e0c86c08df1252c2f3ff489eef72 Mon Sep 17 00:00:00 2001 From: Cheng Date: Tue, 10 Dec 2024 09:59:55 +0900 Subject: [PATCH] Fix library output directory for MSVC --- python/src/CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/python/src/CMakeLists.txt b/python/src/CMakeLists.txt index 104ad6d690..943f024550 100644 --- a/python/src/CMakeLists.txt +++ b/python/src/CMakeLists.txt @@ -29,8 +29,19 @@ if(NOT MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY) set(MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) endif() -set_target_properties(core PROPERTIES LIBRARY_OUTPUT_DIRECTORY - ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY}) +set_target_properties( + core + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY} + # Do not append a sub-dir for multi-config generators like MSVC + # and XCode. + LIBRARY_OUTPUT_DIRECTORY_RELEASE + ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY} + LIBRARY_OUTPUT_DIRECTORY_DEBUG + ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY} + LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO + ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY} + LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL + ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY}) target_link_libraries(core PRIVATE mlx) target_compile_definitions(core PRIVATE _VERSION_=${MLX_VERSION})