title: From Makefile to Cmake
body: <p>because of CLion release i'd like to move from make to CMake. 
  So i have source folder with bunch of <code>.cpp</code> and <code>.hpp</code> files and a <code>main.cpp</code> with uses classes from source above  - so far i had easy Makefile to compile, link and make exec out of <code>main.cpp</code>:</p>
  
  <pre><code>C_OBJS := $(shell find source/*/ -name '*.cpp')
  SOURCES=source/main.cpp $(C_OBJS)
  OBJECTS=$(SOURCES:.cpp=.o)
  EXECUTABLE=bin/main
  
  $(EXECUTABLE_T): $(OBJECTS_T) 
  $(CC) $(LDFLAGS) $(OBJECTS_T) -o $@
  
  $(EXECUTABLE): $(OBJECTS) 
  $(CC) $(LDFLAGS) $(OBJECTS) -o $@
  
  %.o: %.cpp 
  $(CC) $(CFLAGS) $&lt; -c -o $@
  
  all: $(EXECUTABLE)
  </code></pre>
  
  <p>In Cmake i came to something like that:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8.4)
  project(Main)
  
  #grab all file we need to compile
  file(GLOB SRC
      "source/*.h"
      "source/*.hpp"
      "source/*.cpp"
  )
  
  #compile to .o files all we need
  add_library( myLib ${SRC} )
  
  set(SOURCE_FILES source/main.cpp)
  
  #compile to .o main.cpp
  add_executable( Main ${SOURCE_FILES} )
  
  #link them all
  target_link_libraries( Main myLib )
  </code></pre>
  
  <p>But i keep getting "undefined reference to" to all my classes at the linking and judging by compilation time feels like not everything is compiled. Could you help? :)</p>