From: Magnus Jacobsson Date: Mon, 14 Sep 2020 13:12:49 +0000 (+0200) Subject: Fix math library not linked with lib/gvc for Linux CMake builds X-Git-Tag: 2.46.0~20^2^2~68^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a1923ab80c17bf5d196a326cddd4e35d91feb3a;p=graphviz Fix math library not linked with lib/gvc for Linux CMake builds This is what the autotools builds do. $(MATH_LIB) was already referenced by lib/gvc/CmakeLists.txt, but it was never given any value. For Windows, this is not necessary since math functions are included in the Universal C Runtime library (UCRT). Without this, the rtest/test_examples.py gave errors like this for e.g. demo.c: /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgvc.so: undefined reference to `atan2' --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 63a493e24..e42faae1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,10 @@ find_package(LTDL) find_package(PangoCairo) find_package(ZLIB) +if (UNIX) + find_library(MATH_LIB m) +endif () + if (WIN32) # Find Windows specific dependencies find_package(RxSpencer REQUIRED)