From 2aaf619012827a0977d8f543b7635c607d7deff6 Mon Sep 17 00:00:00 2001 From: "M. von Buelow" Date: Thu, 11 Jun 2026 17:37:56 +0200 Subject: [PATCH] Allow Framework and Go4Engine to be built separately. --- CMakeLists.txt | 30 ++++++++++++++++++------------ framework/CMakeLists.txt | 3 +++ go4engine/CMakeLists.txt | 6 +++++- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fff0541..80a80eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,22 +72,28 @@ install(FILES ${CMAKE_BINARY_DIR}/StreamConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) -add_subdirectory(framework) +option(ENABLE_FRAMEWORK "Build framework subdirectory" ON) +option(ENABLE_GO4ENGINE "Build go4engine subdirectory" ON) -if(Go4_FOUND) - add_subdirectory(go4engine) +if(ENABLE_FRAMEWORK) + add_subdirectory(framework) +endif() + +if(ENABLE_GO4ENGINE AND Go4_FOUND) + add_subdirectory(go4engine) endif() get_property(__allHeaders GLOBAL PROPERTY STREAM_HEADER_TARGETS) add_custom_target(move_headers ALL DEPENDS ${__allHeaders}) -export( - EXPORT ${PROJECT_NAME}Targets - NAMESPACE stream:: - FILE ${PROJECT_NAME}Targets.cmake) - -install( - EXPORT ${PROJECT_NAME}Targets - NAMESPACE stream:: - DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) +if(ENABLE_FRAMEWORK) + export( + EXPORT ${PROJECT_NAME}Targets + NAMESPACE stream:: + FILE ${PROJECT_NAME}Targets.cmake) + install( + EXPORT ${PROJECT_NAME}Targets + NAMESPACE stream:: + DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) +endif() diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index 4e01086..b3cc49c 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -135,6 +135,8 @@ STREAM_LINK_LIBRARY(Stream LIBRARIES ${stream_libs} ) +add_library(stream::Stream ALIAS Stream) + # ================== Install Stream headers ========== foreach(dir base dogma get4 hadaq mbs nx dabc) @@ -175,4 +177,5 @@ if(ROOT_FOUND) install(FILES ${CMAKE_BINARY_DIR}/lib/libStreamDict.rootmap ${CMAKE_BINARY_DIR}/lib/libStreamDict_rdict.pcm DESTINATION ${CMAKE_INSTALL_LIBDIR}) + add_library(stream::StreamDict ALIAS StreamDict) endif() diff --git a/go4engine/CMakeLists.txt b/go4engine/CMakeLists.txt index 417b34b..2065349 100644 --- a/go4engine/CMakeLists.txt +++ b/go4engine/CMakeLists.txt @@ -1,5 +1,9 @@ include(${GO4_USE_FILE}) +if(NOT TARGET stream::Stream) + find_package(Stream REQUIRED PATHS $ENV{STREAMSYS}) +endif() + GO4_USER_ANALYSIS( LINKDEF LinkDef.h @@ -11,7 +15,7 @@ GO4_USER_ANALYSIS( TUserSource.cxx TFirstStepProcessor.cxx LIBRARIES - Stream StreamDict + stream::Stream stream::StreamDict INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include TARGET_DIR