qiBuild documentation

Using submodules

qi_submodule_create(name [NO_SOURCE_GROUP]
    [SOURCE_GROUP <source_group>]
    [SRC <src> ...]
    [DEPENDS <depends> ...]
)
Arguments:
  • name – The name of the submodule
  • NO_SOURCE_GROUP – Do not create a source_group
  • SOURCE_GROUP – By default a source_group with name is created, if sourcegroup is specified then the source_group name will be name\sourcegroup
  • SRC – The list of source to include in the submodule
  • DEPENDS – The list of dependencies

A submodule is a convenient place to store source paths, dependencies and public headers. Submodule can be added a library or a module. Submodules are directly visible in Visual Studio.

Example

##
## Sample submodule
##

project(QiSubModule)

# creates a submodule named 'mysubmodule'. It have 3 sources files and brings a dependencies on qt_core
qi_submodule_create(mysubmodule SRC mylib.cpp myprivateheader.hpp mypublicheader.hpp
                                DEPENDS qt_core)

# appends files related to boost to the submodule, this will occur only if
# WITH_BOOST is defined.
qi_submodule_add(mysubmodule SRC mylibboostfeature.cpp myprivateboostheader.hpp mypublicboostheader.hpp
                          DEPENDS boost
                          IF WITH_BOOST)

# this creates a binary that have a dependencies on Qt and boost (if WITH_BOOST is set)
# sources are taken from the submodule. Dependencies are linked with when appropriate.
qi_create_bin(mybin SUBMODULE mysubmodule)
qi_submodule_add(name [NO_SOURCE_GROUP]
    [SOURCE_GROUP <source_group>]
    [IF <if>]
    [SRC <src> ...]
    [DEPENDS <depends> ...]
)
Arguments:
  • name – The name of the submodule
  • NO_SOURCE_GROUP – Do not create a source_group.
  • SOURCE_GROUP – By default a source_group with name is created, if sourcegroup is specified then the source_group name will be name\sourcegroup
  • IF – Condition that should be verified before adding content for example (WITH_QT)
  • SRC – The list of sources to include in the submodule
  • DEPENDS – The list of dependencies

This function is similar to qi_submodule_create but appends content to the submodule. This function can be conditional, if you specify IF then the content will be appended to the submodule only if all the flags are defined.