Build with separate src, include and build subdirectories

Hi I’d like to create a CMake managed project with the following example directory structure:

root - mainly empty, perhaps just a cmaklistfiles.txt file
root/src/main.cpp
root/include/main.hpp
root/build/

Where root is the ‘project directory’

I’d like the main.cpp to be able to just #include “main.hpp” without having to use do #include “include/main.hpp”

Ideally one CMakeListFiles.txt in the root directory, but I can like with sub dirs.
This is an exectuable. Might want to end up adding a root/test dir too.

Modern version of CMake, e.g. 3.1+
Using make on linux and optionally nmake on windoze FWIW.

Apologies if this is documented or answered elsewhere - just link me the answer if that’s the case.

Tim.

I’d go with:
root/CMakeLists.txt:

<usual boilerplate>
...
add_library(build_settings INTERFACE)
target_include_directories(build_settings INTERFACE include)
#here you could add other stuff to "build_settings"
...
add_subdirectory(src)

And then in root/src/CMakeLists.txt:

...
add_executable(my_exec ...)
target_link_libraries(my_exec PRIVATE build_settings)
...

There may be typos - I’ve typed it from memory