undefined reference to `shm_open' using CMake
问题 I am using CMake under Ubuntu 14.04 to configure my project. I need to use a 3rd party library (say stuff.so). In the CMakeLists.txt, I use TARGET_LINK_LIBRARIES to link the stuff library. However, I got an error: DIR_TO_LIB/stuff.so:-1: error: undefined reference to `shm_open' I tried to put these flag in the CMakeLists.txt but it didn't work: set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lrt") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lrt") A post (link) saying that -lrt should be