There doesn’t seem to be a lot of introductory level information for Cling online. I learned the basics by reading the forum, asking a couple questions on the forum, exploring the code, and experimenting. I’m planning to embed Cling, and needed an introductory document for the few other people that will be involved. The document is Linux/GCC based since that is what we use. The document is attached.
If the contents of the document are correct, anyone is welcome to use it / re-post it. If you find any errors, or have any helpful suggestions please let me know.
Very nice, thanks for sharing this! One of the most relevant suggestions for improvements is probably the embedding part: we have a demo binary exactly for this purpose; you can find it at cling/tools/demo/. It comes with a CMakeLists.txt which shows how to do this; I’d recommend you advocate for that rather than a separate build script - which might get out of date at some point, or might not cover all cases.
Congratulations and thanks a lot for doing this! I think this would be a perfect web page to be added to the cling section of our site. Would you be willing to donate it, maybe even in the form of a PR against the website?
I cannot get the demo to build. As the README specifies I ran:
:~/software/cling$ cmake -Dcling_DIR=/home/ubuntu/software/cling/obj/lib/cmake/cling /home/ubuntu/software/cling/src/tools/cling/tools/demo
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:25 (find_package):
By not providing "Findcling.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "cling", but
CMake did not find one.
Could not find a package configuration file provided by "cling" with any of
the following names:
clingConfig.cmake
cling-config.cmake
Add the installation prefix of "cling" to CMAKE_PREFIX_PATH or set
"cling_DIR" to a directory containing one of the above files. If "cling"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/software/cling/CMakeFiles/CMakeOutput.log".
I tried numerous variations of this, but nothing works, probably because neither clingConfig.cmake nor cling-config.cmake exist in the cling installation.