Skip to content

Commit 1c4c962

Browse files
committed
Add docs
Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
1 parent 7aaa7cf commit 1c4c962

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

doc/rst/usingchapel/compiling.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,16 @@ code:
241241
add_executable(myChapelProgram main.chpl)
242242
target_link_options(main PRIVATE -I${CMAKE_SOURCE_DIR}/include)
243243
target_link_libraries(myChapelProgram PRIVATE myCCode)
244+
245+
To enable use of CMake-based projects with the :ref:`language server <readme-chpl-language-server>`,
246+
the CMake integration provides a special variable ``CMAKE_EXPORT_CHPL_COMMANDS``.
247+
When set to ``ON``, CMake will generate a file named ``.cls_commands.json`` in
248+
the build directory. This file can be read by the language server to understand
249+
the module structure of the project. For example:
250+
251+
.. code-block:: sh
252+
253+
mkdir build && cd build
254+
cmake .. -CMAKE_EXPORT_CHPL_COMMANDS=ON
255+
cmake --build .
256+
cd .. && ln -s build/.cls_commands.json .cls_commands.json

util/cmake/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,13 @@ project(hello LANGUAGES CHPL)
1515
1616
add_executable(hello hello.chpl)
1717
```
18+
19+
## Language Server Integration
20+
21+
To enable Chapel Language Server integration, set `CMAKE_EXPORT_CHPL_COMMANDS` to `ON`:
22+
23+
```cmake
24+
set(CMAKE_EXPORT_CHPL_COMMANDS ON)
25+
```
26+
27+
This will generate a `.cls-commands.json` file in your build directory that the Chapel Language Server can use to understand your project's module paths and source files.

0 commit comments

Comments
 (0)