Adding explicit link to libm for pure-C curve fitting example. - Any pure-C program #including <math.h> will need to link against libm, some compilers will let an indirect link slide (via Ceres in this case) but some won't. Change-Id: I6890702fa0d2c3fbb747f0f81fc3fa3631839de4
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5205ccb..28eec9b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt
@@ -41,7 +41,10 @@ TARGET_LINK_LIBRARIES(curve_fitting ceres) ADD_EXECUTABLE(curve_fitting_c curve_fitting.c) -TARGET_LINK_LIBRARIES(curve_fitting_c ceres) +# As this is a C file #including <math.h> we have to explicitly add the math +# library (libm). Although some compilers (dependent upon options) will accept +# the indirect link to libm via Ceres, at least GCC 4.8 on pure Debian won't. +TARGET_LINK_LIBRARIES(curve_fitting_c ceres m) ADD_EXECUTABLE(robust_curve_fitting robust_curve_fitting.cc)