From fbcc8fca421b201b3fd8b85f0e702ca1fdf660c5 Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Fri, 28 Nov 2025 16:30:45 -0800 Subject: [PATCH 1/2] CMakeLists.txt: adding a LIBRARY_ONLY config mode --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14ba1e9..0804917 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,8 @@ add_compile_options( ) if(NOT PROJECT_IS_TOP_LEVEL) - set(STATIC_ANALYSIS OFF) + set(STATIC_ANALYSIS off) + set(LIBRARY_ONLY on) endif() if(STATIC_ANALYSIS) From 6d262ffec0c47921665b87200405fe4806a3f226 Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Fri, 28 Nov 2025 16:36:22 -0800 Subject: [PATCH 2/2] src/CMakeLists.txt: update so that we can avoid building the binary if the project is used as a subproject (subdir/submodule) in another --- src/CMakeLists.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 03fa91a..6345519 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,7 @@ find_package(HTSLIB REQUIRED) -if(NOT TARGET smithlab_cpp) +if(NOT TARGET bamxx) add_subdirectory(bamxx) endif() if(NOT TARGET smithlab_cpp) @@ -28,16 +28,18 @@ add_library(abismal_objs OBJECT AbismalIndex.cpp simreads.cpp ) -target_link_libraries(abismal_objs PUBLIC bamxx smithlab_cpp) -target_include_directories(abismal_objs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -# ADS: below, for config.h -target_include_directories(abismal_objs PUBLIC ${CMAKE_BINARY_DIR}) - -add_executable(abismal abismal_main.cpp) -# ADS: below, for config.h -target_include_directories(abismal PUBLIC ${CMAKE_BINARY_DIR}) -target_link_libraries(abismal PUBLIC - abismal_objs +target_link_libraries(abismal_objs PUBLIC + bamxx smithlab_cpp HTSLIB::HTSLIB ) +# ADS: CMAKE_BINARY_DIR for config.h +target_include_directories(abismal_objs PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} +) + +if(NOT LIBRARY_ONLY) + add_executable(abismal abismal_main.cpp) + target_link_libraries(abismal PRIVATE abismal_objs) +endif()