$ cat /tmp/src/CMakeLists.txt cmake_min/imum_required (VERSION 3.4) project(hello CXX) add_library(foobar SHARED) target_sources(foobar PRIVATE foobar.cc) $ cat /tmp/src/foobar.cc void myfunc() { } $ mkdir /tmp/build $ cd /tmp/build $ ~/tmp/cmake-3.4.0-Linux-x86_64/bin/cmake /tmp/src/ -- The CXX compiler identification is GNU 5.2.1 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done You have called ADD_LIBRARY for library foobar without any source files. This typically indicates a problem with your CMakeLists.txt file -- Configuring done -- Generating done -- Build files have been written to: /tmp/build $