This repository is based on the blog post Using the RDKit in a C++ program as a ready-to-use GitHub template.
NOTE: This branch contains a new variant that uses Conan to build the library.
To get the Conda version, please check the conda branch.
- Python
- Visual Studio (for Windows builds)
- gcc (for GNU Linux)
- clang/Xcode (for macOS)
- Create a new Python virutal environment:
python -m venv .venv
- Activate the new Python virtual environment (for Windows):
.\.venv\Scripts\activate
- Install the
ConanPython package:pip install conan
- Run Conan configuration step
IMPORTANT: You must have a Conan package of RDKit in your local Conan cache!
You can get the Conan RDKit package by following the guide Building the RDKit Conan package.
Once you've built the Conan RDKit package, adjustline 45of theconanfile.pyso that it contains the correct channel. Most common isrdkit/2025.09.3.conan install . - Run CMake build step using the appropriate Conan profile (e.g. Windows):
or for Linux use:
conan build . --profile .\profiles\windows\release
or for macOS use:conan build . --profile ./profiles/linux/releaseconan build . --profile ./profiles/macos/release
IMPORTANT: Be aware that the profiles for Linux and macOS are only tested via the GitHub action workflow.
NOTE: This procedure has been only tested on Windows yet. For macOS and Linux proceed with caution.
The default profiles located under the profiles folder can be used to package the library as a standalone folder.
To change the output folder, modify the local_package_dir property in the conanfile.py file.
In order to build this example using Conan, you'll need to build the RDKit Conan package first, so that it's available via the local Conan cache. To do this, clone the RDKit conan package repo:
git clone https://github.com/urban233/rdkit-conan-package.git
cd rdkit-conan-packageAfter that, proceed with creating the package:
conan create . rdkit/2025.09.03This will build the RDKit library and create a local Conan package.
Now you can proceed with step 4 of the From source section.
To build this example in IDE's such as CLion, you can use CMake profiles. Start with cloning the repository:
git clone https://github.com/urban233/rdkit-cpp-example-template.git
cd rdkit-cpp-example-templateAfter that, install the Conan dependencies by running:
conan install .Be aware that for this, the Conan RDKit package must be present in the local Conan cache. Then, create the CMake profile by running:
cmake . --preset=conan-defaultAfter that you could also build the Conan RDKit package with the command:
cmake --build --preset=conan-releaseor activate the new CMake profile within CLion and then use the GUI to build the project.
This repository also contains a Conda variant that can be used for dependency management. To use it, please first clone the repo:
git clone https://github.com/urban233/rdkit-cpp-example-template.gitand then switch to the conda branch:
cd rdkit-cpp-example-template
git checkout condaThis branch contains a README.md file with instructions on how to use Conda to build the library.
This project is licensed under the BSD License – see the LICENSE file for details.