New Issue: [Feature Request]: Support 'add_library' in CMake module files for Chapel

27107, "jabraham17", "[Feature Request]: Support 'add_library' in CMake module files for Chapel", "2025-04-15T15:04:12Z"

Summary of Feature

Recent effort has significantly expanded the ability of the CMake module files for the Chapel language. However one current gap is the ability to create Chapel libraries that can be included in other programs. When compiling from the command line, this is the --library flag which enables Chapel to compile to a shared/static library that can be included by other languages. The CMake corollary for this is add_library, allowing developers to create a new library target that CMake will generate the build commands for.

This issue is about adding support to the files in util/cmake to have the proper flags to allow users to do this.

Note: This is the last bit of future work laid out in Add prototype support for compiling user programs with CMake by jabraham17 · Pull Request #26374 · chapel-lang/chapel · GitHub
Other related work:

Code Sample

add_library(myChapelLibrary source1.chpl source2.chpl)
...
target_link_libraries(myExecutable myChapelLibrary)