SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
Parsing command line arguments with Sharg

We have separated the feature of parsing command line arguments to its own project:

sharg_logo The Sharg Parser


Sharg & SeqAn

You can easily setup Sharg parallel to SeqAn as we use the exact same infrastructure.

If you have completed the Quick Setup (using CMake), do the following to also include the Sharg parser:

  1. In the tutorial directory, clone the Sharg parser
    git clone https://github.com/seqan/sharg-parser.git
    Your directory structure now looks like this:
    tutorial
    ├── build
    ├── seqan3
    └── sharg-parser
    └── source
  2. Adapt your CMake script:
cmake_minimum_required (VERSION 3.5...3.30)
project (seqan3_tutorial CXX)
# add seqan3 to search path
list (APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../seqan3/cmake")
# add the Sharg Parser to search path
list (APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../sharg-parser/build_system")
# require seqan3 with a version between >=3.0.0 and <4.0.0
find_package (seqan3 3.0 REQUIRED)
find_package (sharg 1.0 REQUIRED)
# build app with seqan3
add_executable (hello_world hello_world.cpp)
target_link_libraries (hello_world seqan3::seqan3 sharg::sharg)
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26

Done!

Now you can do the basic tutorial of the Sharg parser to learn how to conveniently access command line arguments.

Hide me