diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index a2627c190f738..afbdcfb51fd2b 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2074,7 +2074,6 @@ macro(build_jemalloc) target_link_libraries(jemalloc::jemalloc INTERFACE Threads::Threads) target_include_directories(jemalloc::jemalloc BEFORE INTERFACE "${JEMALLOC_INCLUDE_DIR}") - add_dependencies(jemalloc::jemalloc jemalloc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) @@ -2142,7 +2141,6 @@ if(ARROW_MIMALLOC) if(WIN32) target_link_libraries(mimalloc::mimalloc INTERFACE "bcrypt.lib" "psapi.lib") endif() - add_dependencies(mimalloc::mimalloc mimalloc_ep) add_dependencies(toolchain mimalloc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index c1fafeebc035d..2c7cdef8b1a8c 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -351,31 +351,25 @@ set(ARROW_TESTING_SRCS testing/util.cc) # Add dependencies for third-party allocators. -# If possible we only want memory_pool.cc to wait for allocators to finish building, +# If possible we only want memory_pool{_jemalloc}.cc to wait for allocators to finish building, # but that only works with Ninja # (see https://gitlab.kitware.com/cmake/cmake/issues/19677) -set(_allocator_dependencies "") # Empty list if(jemalloc_VENDORED) - list(APPEND _allocator_dependencies jemalloc_ep) + if("${CMAKE_GENERATOR}" STREQUAL "Ninja") + set_source_files_properties(memory_pool_jemalloc.cc PROPERTIES OBJECT_DEPENDS jemalloc_ep) + else() + add_dependencies(arrow_dependencies jemalloc_ep) + endif() endif() if(mimalloc_VENDORED) - list(APPEND _allocator_dependencies mimalloc_ep) -endif() - -if(_allocator_dependencies) if("${CMAKE_GENERATOR}" STREQUAL "Ninja") - set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS - "${_allocator_dependencies}") + set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS mimalloc_ep) else() - add_dependencies(arrow_dependencies ${_allocator_dependencies}) + add_dependencies(arrow_dependencies mimalloc_ep) endif() - set_source_files_properties(memory_pool.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON - SKIP_UNITY_BUILD_INCLUSION ON) endif() -unset(_allocator_dependencies) - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set_property(SOURCE util/io_util.cc APPEND_STRING