Loading...
Searching...
No Matches
Parsing command line arguments with Sharg

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

## The Sharg Parser

- GitHub Repository: https://github.com/seqan/sharg-parser
- API Documentation: https://docs.seqan.de/sharg.html
- Tutorials: https://docs.seqan.de/sharg/main_user/usergroup1.html

# Sharg & SeqAn

You can easily set up Sharg parallel to SeqAn as we use the 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.20...3.31)
project (seqan3_tutorial CXX)
set (CMAKE_CXX_STANDARD 23)
# 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)
seqan3
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 access command line arguments conveniently.

Hide me