A JSON to CMake tool
- Los Alamos National Lab. (LANL), Los Alamos, NM (United States)
As part of the conversion of the MCNP®testing system to CTest, a tool was needed to generate CMake variables from JSON formatted data structure. The system was first implemented using the JSON to CMake parser which with some slight modifications provided data useful for the MCNP CTest testing system. Upon further evaluation, we found it to be slow when setting up the 1600 tests during the CMake configuration step. Not only was it slow, it did not validate the JSON files during configuration allowing for unexpected behavior. Upon some web searching we came across a simple recursive python example that would provide the same capability needed by our testing system. This python example was effectively wrapped into a single python script that was used to convert the JSON data into CMake variables. This tool is attached as json_to_cmake.py and is listed in the appendix. In essence, the tool provides single variables for each value defined within the JSON file. The name for the variable is constructed by using the associated object names and array indicies needed to deference the variable itself. In the following sections, examples are provided to better describe how this is done.
- Research Organization:
- Los Alamos National Laboratory (LANL), Los Alamos, NM (United States)
- Sponsoring Organization:
- USDOE
- DOE Contract Number:
- 89233218CNA000001
- OSTI ID:
- 1493023
- Report Number(s):
- LA-UR--19-20675
- Country of Publication:
- United States
- Language:
- English
Similar Records
TriBITS (Tribal Build, Integrate, and Test System)
CMinx: A CMake Documentation Generator