Skip to content

Commit 770911c

Browse files
src/CMakeLists.txt: update so that we can avoid building the binary if the project is used as a subproject (subdir/submodule) in another
1 parent 8110860 commit 770911c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
find_package(HTSLIB REQUIRED)
1717

18-
if(NOT TARGET smithlab_cpp)
18+
if(NOT TARGET bamxx)
1919
add_subdirectory(bamxx)
2020
endif()
2121
if(NOT TARGET smithlab_cpp)
@@ -28,16 +28,18 @@ add_library(abismal_objs OBJECT
2828
AbismalIndex.cpp
2929
simreads.cpp
3030
)
31-
target_link_libraries(abismal_objs PUBLIC bamxx smithlab_cpp)
32-
target_include_directories(abismal_objs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
33-
# ADS: below, for config.h
34-
target_include_directories(abismal_objs PUBLIC ${CMAKE_BINARY_DIR})
35-
36-
add_executable(abismal abismal_main.cpp)
37-
# ADS: below, for config.h
38-
target_include_directories(abismal PUBLIC ${CMAKE_BINARY_DIR})
39-
target_link_libraries(abismal PUBLIC
40-
abismal_objs
31+
target_link_libraries(abismal_objs PUBLIC
32+
bamxx
4133
smithlab_cpp
4234
HTSLIB::HTSLIB
4335
)
36+
# ADS: CMAKE_BINARY_DIR for config.h
37+
target_include_directories(abismal_objs PUBLIC
38+
${CMAKE_CURRENT_SOURCE_DIR}
39+
${CMAKE_BINARY_DIR}
40+
)
41+
42+
if(NOT LIBRARY_ONLY)
43+
add_executable(abismal abismal_main.cpp)
44+
target_link_libraries(abismal PRIVATE abismal_objs)
45+
endif()

0 commit comments

Comments
 (0)