cmake_minimum_required(VERSION 2.6) # define compiler in order not to take clang # and clang++ as default compilers # do rm -rf CMakeFiles/* CMakeCache.txt # if it is not working set( CMAKE_C_COMPILER "/usr/bin/gcc" ) set( CMAKE_CXX_COMPILER "/usr/bin/g++" ) project(MyProject) set( CMAKE_BUILD_TYPE release ) set( EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE} ) file( GLOB_RECURSE source_files src/*.cpp ) # will generate the binary ./main.exe add_executable( main.exe ${source_files} )