diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bdc8df1c..55680001 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,26 +7,32 @@ cmake_minimum_required (VERSION 3.18) -if (NOT TARGET chopper_shared) - add_library (chopper_shared STATIC configuration.cpp input_functor.cpp) - - target_link_libraries (chopper_shared PUBLIC seqan3::seqan3) - target_link_libraries (chopper_shared PUBLIC sharg::sharg) - target_link_libraries (chopper_shared PUBLIC seqan::hibf) - target_include_directories (chopper_shared PUBLIC ../include) - target_compile_options (chopper_shared PUBLIC "-pedantic" "-Wall" "-Wextra") +if (TARGET chopper::interface) + return () endif () +add_library (chopper_interface INTERFACE) +target_link_libraries (chopper_interface INTERFACE seqan::hibf sharg::sharg seqan3::seqan3) +target_include_directories (chopper_interface INTERFACE "${PROJECT_SOURCE_DIR}/include") +target_compile_options (chopper_interface INTERFACE "-pedantic" "-Wall" "-Wextra") +add_library (chopper::interface ALIAS chopper_interface) + +add_library (chopper_shared STATIC configuration.cpp input_functor.cpp) +target_link_libraries (chopper_shared PUBLIC chopper_interface) +add_library (chopper::shared ALIAS chopper_shared) + add_library (chopper_lib STATIC chopper_layout.cpp set_up_parser.cpp) -target_link_libraries (chopper_lib PUBLIC chopper_layout chopper_sketch) +target_link_libraries (chopper_lib PUBLIC chopper::layout chopper::sketch) +add_library (chopper::chopper ALIAS chopper_lib) add_executable (chopper chopper.cpp) -target_link_libraries (chopper PUBLIC chopper_lib) +target_link_libraries (chopper PUBLIC chopper::chopper) add_subdirectory (layout) add_subdirectory (sketch) add_subdirectory (util) if (CHOPPER_INSTALL) + include (GNUInstallDirs) install (TARGETS chopper RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif () diff --git a/src/layout/CMakeLists.txt b/src/layout/CMakeLists.txt index 3faee796..915c83d7 100644 --- a/src/layout/CMakeLists.txt +++ b/src/layout/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required (VERSION 3.18) -if (NOT TARGET chopper_layout) - add_library (chopper_layout STATIC determine_best_number_of_technical_bins.cpp execute.cpp hibf_statistics.cpp - ibf_query_cost.cpp input.cpp output.cpp - ) - - target_link_libraries (chopper_layout PUBLIC chopper_shared) +if (TARGET chopper::layout) + return () endif () + +add_library (chopper_layout STATIC determine_best_number_of_technical_bins.cpp execute.cpp hibf_statistics.cpp + ibf_query_cost.cpp input.cpp output.cpp +) +target_link_libraries (chopper_layout PUBLIC chopper::shared) +add_library (chopper::layout ALIAS chopper_layout) diff --git a/src/sketch/CMakeLists.txt b/src/sketch/CMakeLists.txt index 9d7f6feb..4b5e67f4 100644 --- a/src/sketch/CMakeLists.txt +++ b/src/sketch/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required (VERSION 3.18) -if (NOT TARGET chopper_sketch) - add_library (chopper_sketch STATIC check_filenames.cpp output.cpp read_data_file.cpp) - - target_link_libraries (chopper_sketch PUBLIC chopper_shared) +if (TARGET chopper::sketch) + return () endif () + +add_library (chopper_sketch STATIC check_filenames.cpp output.cpp read_data_file.cpp) +target_link_libraries (chopper_sketch PUBLIC chopper::shared) +add_library (chopper::sketch ALIAS chopper_sketch) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index e38d4a0d..72dcff1b 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -7,7 +7,11 @@ cmake_minimum_required (VERSION 3.18) +if (TARGET measure_hyperloglog) + return () +endif () + add_executable (measure_hyperloglog EXCLUDE_FROM_ALL measure_hyperloglog.cpp) -target_link_libraries (measure_hyperloglog PUBLIC chopper_lib) +target_link_libraries (measure_hyperloglog PUBLIC chopper::chopper) add_subdirectory (display_layout) diff --git a/src/util/display_layout/CMakeLists.txt b/src/util/display_layout/CMakeLists.txt index da0404ff..ed9e7a2b 100644 --- a/src/util/display_layout/CMakeLists.txt +++ b/src/util/display_layout/CMakeLists.txt @@ -7,5 +7,9 @@ cmake_minimum_required (VERSION 3.18) +if (TARGET display_layout) + return () +endif () + add_executable (display_layout EXCLUDE_FROM_ALL display_layout.cpp general.cpp process_file.cpp sizes.cpp) -target_link_libraries (display_layout PUBLIC chopper_lib) +target_link_libraries (display_layout PUBLIC chopper::chopper)