title: CMake: Not Connecting -lrt to project
body: <p>I have a project, dependent on the rt library, that shows undeclared errors for functions ddefined in LIBRT when using make following running the "cmake .". I've looked at the plethora of suggestions for questions similar to this but none worked for me. Using the functions check_include_files() and check_library_exists() return TRUE, and it appears I succeed in finding the library using find_library(). I even get "-lrt" appended at the end of the link.txt file. </p>
  
  <p>Anyways, I am a bit stumped and looking for some guidance. Below is my CMakeLists.txt file:</p>
  
  <pre><code>cmake_minimum_required (VERSION 3.5)
  project (proj_name C)   
  enable_language(C)
  
  set (SOURCES
     /source/file/path
  )
  
  add_definitions (-std=c99)
  add_executable (proj_name ${SOURCES})
  
  find_library(LIBRT rt)
  if(LIBRT)
      target_include_directories (proj_name PUBLIC ${PROJECT_SOURCE_DIR} 
          /proj/includes/path #not including rt header path 
          ${RT_INCLUDE_DIRS}
      )
      target_link_libraries(proj_name PUBLIC ${LIBRT})
  endif(LIBRT)
  
  set(CMAKE_C_COMPILER /usr/bin/gcc)
  
  include(CheckIncludeFiles)
  check_include_files(mqueue.h HAVE_MQUEUE_H)
  if(NOT HAVE_MQUEUE_H)
      message(FATAL_ERROR "mqueue.h not found")
  endif(NOT HAVE_MQUEUE_H)
  
  include(CheckLibraryExists)
  check_library_exists(rt timer_gettime "" HAVE_RT)
  if(NOT HAVE_RT)
      message(FATAL_ERROR "timer_gettime not found")
  endif(NOT HAVE_RT)
  </code></pre>
  
  <p>Running on WSL Ubuntu.</p>
  
  <p>Thanks for any insight possible!</p>