Skip to content

Commit 63fca8b

Browse files
authored
fix: CMake install directories on Windows (#715)
Ensures the proper target directories also on windows (`dll`s to `bin`, `lib`s to `lib`)
1 parent e77a656 commit 63fca8b

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

Diff for: CMakeLists.txt

+26-12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ set(NANOARROW_VERSION_MAJOR "${nanoarrow_VERSION_MAJOR}")
2727
set(NANOARROW_VERSION_MINOR "${nanoarrow_VERSION_MINOR}")
2828
set(NANOARROW_VERSION_PATCH "${nanoarrow_VERSION_PATCH}")
2929

30+
include(GNUInstallDirs)
31+
3032
# General options
3133
option(NANOARROW_NAMESPACE "A prefix for exported symbols" OFF)
3234

@@ -77,8 +79,10 @@ endif()
7779

7880
add_library(nanoarrow_coverage_config INTERFACE)
7981
install(TARGETS nanoarrow_coverage_config
80-
DESTINATION lib
81-
EXPORT nanoarrow-exports)
82+
EXPORT nanoarrow-exports
83+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
84+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
85+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
8286

8387
if(NANOARROW_CODE_COVERAGE)
8488
target_compile_options(nanoarrow_coverage_config INTERFACE -O0 -g --coverage)
@@ -186,8 +190,10 @@ if(NANOARROW_IPC)
186190
PUBLIC $<BUILD_INTERFACE:${NANOARROW_FLATCC_INCLUDE_DIR}>
187191
$<INSTALL_INTERFACE:include>)
188192
install(TARGETS flatccrt
189-
DESTINATION lib
190-
EXPORT nanoarrow-exports)
193+
EXPORT nanoarrow-exports
194+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
195+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
196+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
191197

192198
elseif(NOT NANOARROW_FLATCC_ROOT_DIR)
193199
add_library(flatccrt STATIC IMPORTED)
@@ -240,7 +246,10 @@ if(NANOARROW_IPC)
240246
$<BUILD_INTERFACE:${NANOARROW_IPC_FLATCC_INCLUDE_DIR}>
241247
$<INSTALL_INTERFACE:include>)
242248

243-
install(TARGETS nanoarrow_ipc DESTINATION lib)
249+
install(TARGETS nanoarrow_ipc
250+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
251+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
252+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
244253
install(FILES src/nanoarrow/nanoarrow_ipc.h src/nanoarrow/nanoarrow_ipc.hpp
245254
src/nanoarrow/ipc/flatcc_generated.h DESTINATION include/nanoarrow)
246255
install(FILES src/nanoarrow/hpp/array_stream.hpp
@@ -303,8 +312,10 @@ if(NANOARROW_DEVICE)
303312
target_include_directories(nanoarrow_metal_impl
304313
PRIVATE ${NANOARROW_DEVICE_INCLUDE_METAL})
305314
install(TARGETS nanoarrow_metal_impl
306-
DESTINATION lib
307-
EXPORT nanoarrow-exports)
315+
EXPORT nanoarrow-exports
316+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
317+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
318+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
308319

309320
set(NANOARROW_DEVICE_SOURCES_METAL src/nanoarrow/device/metal.cc)
310321
set(NANOARROW_DEVICE_DEFS_METAL "NANOARROW_DEVICE_WITH_METAL")
@@ -359,8 +370,10 @@ if(NANOARROW_TESTING
359370

360371
add_subdirectory("thirdparty/nlohmann_json")
361372
install(TARGETS nlohmann_json
362-
DESTINATION lib
363-
EXPORT nanoarrow-exports)
373+
EXPORT nanoarrow-exports
374+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
375+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
376+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
364377

365378
add_library(nanoarrow_testing src/nanoarrow/testing/testing.cc)
366379
target_include_directories(nanoarrow_testing
@@ -405,8 +418,10 @@ foreach(target
405418

406419
# Ensure target is added to nanoarrow-exports
407420
install(TARGETS ${target}
408-
DESTINATION lib
409-
EXPORT nanoarrow-exports)
421+
EXPORT nanoarrow-exports
422+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
423+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
424+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
410425

411426
# For debug builds, ensure we aggressively set compiler warning flags and
412427
# error for any compiler warnings
@@ -701,7 +716,6 @@ endif()
701716

702717
# Generate package files for the build and install trees.
703718
include(CMakePackageConfigHelpers)
704-
include(GNUInstallDirs)
705719

706720
foreach(tree_type BUILD INSTALL)
707721
if(tree_type STREQUAL "BUILD")

0 commit comments

Comments
 (0)