无论如何可以在 ubuntu 上将 cmake 与 mqueue.h 一起使用

Is there anyway to use cmake with mqueue.h on ubuntu

CMakeFiles/mqcreate.dir/mqcreate1.cc.o: 在函数中 main': mqcreate1.cc:(.text+0xa0): undefined reference tomq_open' mqcreate1.cc:(.text+0xad): 未定义引用`mq_close'

试试这个:

   find_library(LIBRT rt) 
   if(LIBRT)
      target_link_libraries(target_name ${LIBRT})
   endif()

link to the source