title: Force cmake to use older boost library
body: <p>I want to compile a simple project using the Point Cloud Library. Unfortunately it uses an older version of the boost library as I currently have installed via official repositories.</p>
  
  <p>So I installed the older libraries in <code>/opt/oldlibs/boost/libs</code>. I try to set in the CMakeLists.txt this new path, but somehow cmake still uses the current version installed in <code>/usr/lib</code>. Did I do something wrong in my <code>CMakeLists.txt</code> file?</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
  cmake_policy(SET CMP0053 OLD)
  
  project(cloud_viewer)
  
  find_package(PCL 1.2 REQUIRED)
  
  include_directories(${PCL_INCLUDE_DIRS})
  link_directories(${PCL_LIBRARY_DIRS})
  add_definitions(${PCL_DEFINITIONS})
  
  # Add old boost library
  link_directories("/usr/oldlibs/libs")
  set(Boost_NO_SYSTEM_PATHS TRUE)
  if (Boost_NO_SYSTEM_PATHS)
    set(BOOST_ROOT "/opt/oldlibs/boost")
    set(BOOST_INCLUDE_DIRS "/usr/include/boost")
    set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/libs")
  endif (Boost_NO_SYSTEM_PATHS)
  find_package(Boost REQUIRED regex date_time system filesystem thread graph program_options serialization iostreams chrono atomic)
  include_directories(${BOOST_INCLUDE_DIRS})
  
  add_executable (cloud_viewer cloud_viewer.cpp)
  target_link_libraries (cloud_viewer ${PCL_LIBRARIES})
  </code></pre>
  
  <p>The (part of the) output of cmake is:</p>
  
  <pre><code>-- Boost version: 1.64.0
  -- Found the following Boost libraries:
  --   regex
  --   date_time
  --   system
  --   filesystem
  --   thread
  --   graph
  --   program_options
  --   serialization
  --   iostreams
  --   chrono
  --   atomic
  </code></pre>
  
  <p>But I need 1.63. What do I do wrong? I use arch linux, my current cmake version is 3.8.2.</p>
  
  <h2>Edit</h2>
  
  <p>I updated <code>CMakeLists.txt</code>:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
  cmake_policy(SET CMP0053 OLD)
  
  project(cloud_viewer)
  
  find_package(PCL 1.2 REQUIRED)
  
  include_directories(${PCL_INCLUDE_DIRS})
  link_directories(${PCL_LIBRARY_DIRS})
  add_definitions(${PCL_DEFINITIONS})
  
  # Add old boost library
  set(BOOST_VERSION_REQUIRED "1.63.0")
  
  set(Boost_NO_SYSTEM_PATHS TRUE)
  if (Boost_NO_SYSTEM_PATHS)
    set(BOOST_ROOT "/opt/oldlibs/boost")
    set(BOOST_INCLUDE_DIRS "${BOOST_ROOT}/include")
    set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/lib")
  endif (Boost_NO_SYSTEM_PATHS)
  
  include_directories(${BOOST_INCLUDE_DIRS})
  find_package(Boost ${BOOST_VERSION_REQUIRED} EXACT REQUIRED regex date_time system filesystem thread graph program_options serialization iostreams chrono atomic)
  
  add_executable (cloud_viewer cloud_viewer.cpp)
  target_link_libraries (cloud_viewer ${PCL_LIBRARIES})
  </code></pre>
  
  <p>Cmake now understands I want to use an older version, but still can't find it. Did I do another mistake? I installed the older package by extracting the by packman cached version from <code>/var/cache/pacman/pkg/' and extracted it to</code>/opt/oldlibs/boost/`.</p>
  
  <p>The usr directory looks like this:</p>
  
  <pre><code>usr
  ├── oldlib
  │   ├── boost
  │   │   ├── bin
  │   │   ├── include (contains all header files)
  │   │   ├── lib (contains all libraries, static and shared)
  │   │   └── share
  </code></pre>
  
  <p>This is a part of the cmake output:</p>
  
  <pre><code>CMake Error at /usr/share/cmake-3.8/Modules/FindBoost.cmake:1842 (message):
    Unable to find the requested Boost libraries.
  
    Boost version: 1.64.0
  
    Boost include path: /usr/include
  
    Detected version of Boost is too new.  Requested version was 1.63.
  Call Stack (most recent call first):
    CMakeLists.txt:23 (find_package)
  </code></pre>
  
  <p>I also tried running <code>cmake</code> with the option <code>-DCMAKE_PREFIX_PATH=/opt/oldlibs/boost/lib</code> and varying the path. It didn't change anything.</p>