title: Include another CMake Project as Library
body: <p>I have decided to make a C++-Qt-GUI for a C program (both languages I don’t know), using KDevelop, which in turn uses CMake.</p>
  
  <p>The C source has no header, so I made one, and migrated some structs into it, as well as the declaration of the only function in the C source i need to call.</p>
  
  <p>The problem is that I can’t call it, because either CMake doesn’t find the C file (and hence the definition), or, when I add the C source to my source set in the CMakeLists.txt, it complains that both my main.cpp and the C source file have main functions.</p>
  
  <p>How do I tell CMake that it should only make the function from the C file available which I declared in the header?</p>
  
  <p>here is it:</p>
  
  <pre><code>project(oregengui)
  cmake_minimum_required(VERSION 2.6)
  find_package(Qt4 REQUIRED)
  
  include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
  
  set(oregengui_SRCS oregengui.cpp main.cpp qrangeslider/qrangeslider.cpp)
  #as soon as i add oregengui/oregengui.c, it won’t work because of the main function
  qt4_automoc(${oregengui_SRCS})
  add_executable(oregengui ${oregengui_SRCS})
  target_link_libraries(oregengui ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
  </code></pre>
  
  <p>PS: I don’t want to change the C source too much, since it is a independant project. I guess the developer will accept the introduction of the header, but not much more.</p>