# Multi-Module Projects with Cangjie

DevFeed: [Multi-Module Projects with Cangjie](<https://devfeed.tech/articles/multi-module-projects-with-cangjie-24552.md>)

Original publisher: [Read original article](<https://medium.com/snapp-mobile/multi-module-projects-with-cangjie-c43236c37292?source=rss----bcd96e620b02---4>)

Author: Jasper Morgan

Published: 2025-09-02T12:39:21Z

Content type: tutorial

Language: en

Sources: [Snapp Mobile - Medium](<https://devfeed.tech/sources/snapp-mobile-medium.md>)

Topics: [Package manager](<https://devfeed.tech/topics/package-manager.md>), [modules](<https://devfeed.tech/topics/modules.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Code](<https://devfeed.tech/topics/code.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>)

Tags: [building](<https://devfeed.tech/tags/building.md>), [cangjie](<https://devfeed.tech/tags/cangjie.md>), [cli](<https://devfeed.tech/tags/cli.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [huawei](<https://devfeed.tech/tags/huawei.md>), [init](<https://devfeed.tech/tags/init.md>), [module](<https://devfeed.tech/tags/module.md>), [programming](<https://devfeed.tech/tags/programming.md>), [run](<https://devfeed.tech/tags/run.md>), [structure](<https://devfeed.tech/tags/structure.md>)

## AI overview

A tutorial on using the Cangjie package manager, cjpm, to create and configure multi-module projects. It covers initializing a workspace, adding executable and library modules, registering them in the workspace configuration, adding source code, building, and running the project.

## Source excerpt

The Cangjie package manager cjpm is a cli tool which can be used to setup multi-module projects. A module is simply a folder with a cjpm.toml file - whilst these can also be created by hand, the cli tool simplifies the process. The approach to the setup is to create a cjpm workspace at the project root and then separate module within the workspace. It will look like this: my-project (workspace) -- module-1 -- module-2 -- module-3Create the workspace In the root of your project, initialise a workspace: # create a project folder mkdir cat-pic-downloader cd cat-pic-downloader # initialise the workspace cjpm init --workspace At this stage, your project directory will have a cjpm.toml which is the configuration for your workspace. A newly initialised workspace config will look like this. [dependencies] [workspace] build-members = [] compile-option = "" link-option = "" members = [] target-dir = "" test-members = []Add the modules To add a module to the project, use the cjpm init command but with the options to specify the type of module to create (executable, a static library or a dynamic library). Let's add a couple of modules to our sample project. # create a static lib module called 'downloader' cjpm init --type=static --path downloader # create a static lib module called 'img-processor' cjpm init --type=static --path img_processor # create an executable module called 'runner' cjpm init --type=executable --path runner By default, a newly created module has a src directory and it's own cjpm.toml to configure the module. (Static library modules will have no source code. Executable modules will have a main.cj file.) Add the modules to the workspace So that the workspace is aware of the modules we created, we need to add them to the members field of the workspace's cjpm.toml. Edit the cjpm.toml as follows. [dependencies] [workspace] build-members = [] compile-option = "" link-option = "" members = ["./runner", "./downloader", "./img_processor"] target-dir = "" test-member