I am using CMake to build my project. It shows the error
./../x86_64-conda_cos6-linux-gnu/bin/ld: /home/lee/bin/ants/lib/libitkgdcmopenjp2-5.0.a(tcd.c.o): in function 'opj_tcd_init_encode_tile': tcd.c:(.text+0x1d42): undefined reference to '__pow_finite'
I googled and it said that I have to include extra libs that is the math lib lm
. I have tried two ways:
Build with
cmake CMAKE_SHARED_LINKER_FLAGS="-lm" ..
However, it is not workAdd
lm
in the CMakeLists.txt:target_link_libraries(lm myprogram ${ITK_LIBRARIES})
. But it shows the errorCannot specify link libraries for target "lm" which is not built by this project.
Could you tell me any suggestion to fix it?