title: How to make cmake output to the "build" directory?
body: <p>I'm using cmake to compile a C++ project, and I want cmake to generate all the output files(metafiles like <code>Makefile</code> used to create binaries) in the <code>build</code> folder. I've checked all the answers in <a href="https://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir">How do I make cmake output into a &#39;bin&#39; dir?</a>, none of them worked for me(suprisingly!). Files are generated in the root folder instead of in the <code>build</code> folder, what's wrong here? I guess I must have missed something.</p>
  
  <h3>Code Structure</h3>
  
  <pre><code>➜  cmake-test tree .
  .
  ├── CMakeLists.txt
  └── hello.cpp
  
  0 directories, 2 files
  </code></pre>
  
  <h3>CMakeLists.txt</h3>
  
  <pre><code># Specify the minimum version for CMake
  cmake_minimum_required(VERSION 3.11)
  
  # Project's name
  project(hello)
  
  # Set the output folder where your program will be created
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  
  # The following folder will be included
  include_directories("${PROJECT_SOURCE_DIR}")
  
  add_executable(hello ${PROJECT_SOURCE_DIR}/hello.cpp)
  </code></pre>
  
  <h3>Build Commands and Outputs</h3>
  
  <pre><code>➜  cmake-test cmake .
  
  -- The C compiler identification is GNU 8.2.0
  -- The CXX compiler identification is GNU 8.2.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- 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
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/searene/CLionProjects/cmake-test
  
  ➜  cmake-test ls
  
  bin  CMakeCache.txt  CMakeFiles  cmake_install.cmake  CMakeLists.txt  hello.cpp  Makefile
  </code></pre>
  
  <h3>cmake version</h3>
  
  <pre><code>➜  cmake-test cmake --version
  
  cmake version 3.11.4
  
  CMake suite maintained and supported by Kitware (kitware.com/cmake).
  </code></pre>
  
  <h3>OS</h3>
  
  <p>Linux</p>