CMake project, undefined reference in quiet_nan (even with -lm), why?

view story

http://stackoverflow.com – Trying to compile on multiple plataforms having the following CMakeLists: if(UNIX) if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") target_link_libraries(teste socket nsl sunmath) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") target_link_libraries(teste m) endif() endif(UNIX) On Solaris it compiles file, but on Linux I'm getting "undefined reference to `quiet_nan'" in a function which is in a library being compiled with CMake (has its own CMakeLists). The compilation line which gives the error is: /usr/bin/c++ CMakeFiles/teste.dir/cena.cpp.o -o teste -rdynamic libSTDFwrapper. (HowTos)