From 75462c504589987c7235948ea2aca4fd1ed3c7bd Mon Sep 17 00:00:00 2001 From: Ruixiang Du Date: Sun, 12 Jul 2026 21:22:24 +0800 Subject: [PATCH] build: assembly follows the family bin/lib placement convention Every executable -> build/bin, every library -> build/lib, regardless of producing component (previously: driver/nav routed to top-level lib while telemetry/messaging scattered into their component subdirs and bin/ was empty). Guarded (if NOT set) so a parent embedding the superbuild keeps its own layout. Verified: full five-component assembly, 17 binaries in bin/, 24 archives in lib/, zero strays under build/components. --- CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bbc3a8..74a029a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,23 @@ project(xMotion VERSION 0.1.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +# -- Output layout ------------------------------------------------------------ +# The assembly follows the family bin/lib placement convention: every +# executable lands in build/bin and every library in build/lib, regardless +# of which component produced it. Guarded so a parent project embedding +# this superbuild keeps its own layout. Components that already anchor +# their outputs to CMAKE_BINARY_DIR (driver, navigation) align with this +# automatically; the rest inherit it. +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +endif() + # -- Options ---------------------------------------------------------------- # xmBase (foundation) is always built. The rest are opt-in so a consumer only # pays for the dependency footprint it actually needs.