[GiNaC-devel] CMake improvements

Alexey Sheplyakov asheplyakov at yandex.ru
Sun Aug 23 11:03:06 CEST 2020


Hi!

The patchset at 

https://github.com/asheplyakov/ginac/tree/cmake
(git pull git://github.com/asheplyakov/ginac.git cmake)

makes it a bit easier to build and use GiNaC with CMake.

In particular

1) one can build both GiNaC and CLN in one pass (without having to make install,
figure out CFLAGS, LD_LIBRARY_PATH, etc):

git clone -b cmake git://github.com/asheplyakov/ginac.git
cd ginac
git clone -b cmake git://github.com/asheplyakov/cln.git
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j4

2) GiNaC can be included as CMake subproject:

That is, to compile a program `derivative.cpp` (which uses GiNaC) one can download GiNaC sources
into the `ginac` subdirectory (and CLN into ginac/cln subdirectory), and use the following CMakeLists.txt

project(derivative)
add_subdirectory(ginac)
add_executable(derivative derivative.cpp)
target_link_libraries(derivative ginac::ginac) # this adds both libraries and includes/defines

3) Targets are exported, so `find_package(ginac REQUIRED 1.7.0)` works "out of the box"
(this requires CMake'ified CLN)


Best regards,
      Alexey




More information about the GiNaC-devel mailing list