how to use CMake file (GLOB SRCS *. ) with a build directory : <p>this is my current CMakeLists.txt file </p>

<pre><code>cmake_minimum_required(VERSION 3.3)
set(CMAKE_C_FLAGS " -Wall -g ")
project( bmi )
file( GLOB SRCS *.cpp *.h )
add_executable( bmi ${SRCS}) 
</code></pre>

<p>This builds from my source directory, but I have to clean up all the extra files   after. My question is how do I build this from a build directory if all my source files are in the same source directory?     </p>

<p>thanks </p>
