title: No rule to make target '/usr/lib/x86_64-linux-gnu/libboost_filesystem.so`
body: <p>I have <a href="https://github.com/tbrown122387/markets" rel="nofollow noreferrer">a project</a> I'm working on, and I can't get cmake to work after trying to add in some boost functionality. I type</p>
  
  <pre><code>cd build/manual/
  cmake ../..
  make &amp;&amp; make install
  </code></pre>
  
  <p>and I get the following error:</p>
  
  <pre><code>taylor@taylor-XPS-13-9365:~/markets/build/manual$ make &amp;&amp; make install
  Scanning dependencies of target markets
  [  3%] Building CXX object src/markets/CMakeFiles/markets.dir/data_handlers.cpp.o
  [  7%] Building CXX object src/markets/CMakeFiles/markets.dir/data_readers.cpp.o
  [ 11%] Building CXX object src/markets/CMakeFiles/markets.dir/execution_handler.cpp.o
  [ 14%] Building CXX object src/markets/CMakeFiles/markets.dir/fill.cpp.o
  [ 18%] Building CXX object src/markets/CMakeFiles/markets.dir/instrument.cpp.o
  [ 22%] Building CXX object src/markets/CMakeFiles/markets.dir/market_bar.cpp.o
  [ 25%] Building CXX object src/markets/CMakeFiles/markets.dir/market_snapshot.cpp.o
  [ 29%] Building CXX object src/markets/CMakeFiles/markets.dir/order.cpp.o
  [ 33%] Building CXX object src/markets/CMakeFiles/markets.dir/pnl_calculator.cpp.o
  [ 37%] Building CXX object src/markets/CMakeFiles/markets.dir/portfolio.cpp.o
  [ 40%] Building CXX object src/markets/CMakeFiles/markets.dir/position_summary.cpp.o
  [ 44%] Linking CXX static library libmarkets.a
  [ 44%] Built target markets
  Scanning dependencies of target run_backtest
  [ 48%] Building CXX object src/CMakeFiles/run_backtest.dir/main.cpp.o
  make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libboost_filesystem.so,', needed by 'src/run_backtest'.  Stop.
  CMakeFiles/Makefile2:87: recipe for target 'src/CMakeFiles/run_backtest.dir/all' failed
  make[1]: *** [src/CMakeFiles/run_backtest.dir/all] Error 2
  Makefile:129: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <p>This project has several <code>CMakeLists.txt</code> files because there is 1.) a main executable <code>markets/src/main.cpp</code>, 2.) a static library, and 3.) some unit tests in <code>markets/test/</code>. </p>
  
  <p>First, there's <code>markets/CMakeLists.txt</code>:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.10)
  
  set(CMAKE_CXX_STANDARD 11 ) # used to be 17
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
  #set(CMAKE_CXX_COMPILER /usr/bin/g++-8) # this is now set externally!
  set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
  
  set(MARKETS_INSTALL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
  set(MARKETS_INSTALL_BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
  set(MARKETS_INSTALL_LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
  set(MARKETS_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/markets)
  
  include_directories(${MARKETS_INSTALL_INCLUDE_DIR})
  include_directories(${MARKETS_HEADERS_DIR})
  
  add_subdirectory(src)
  add_subdirectory(test)
  </code></pre>
  
  <p>then there's <code>markets/src/CMakeLists.txt</code> (I think this is the one with the problem)</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.10)
  project(run_backtest)
  
  add_subdirectory(markets)
  set(SOURCE_FILES main.cpp)
  
  find_package (Eigen3 3.3 REQUIRED NO_MODULE)
  find_library(mysqlcppconn 1.1.12 REQUIRED)
  find_package(Boost 1.65.1 REQUIRED COMPONENTS system filesystem)
  
  include_directories(${Boost_INCLUDE_DIRS})
  add_executable(run_backtest ${SOURCE_FILES})
  target_link_libraries(run_backtest markets Eigen3::Eigen mysqlcppconn ${Boost_LIBRARIES})
  
  install(TARGETS run_backtest DESTINATION ${MARKETS_INSTALL_BIN_DIR})
  </code></pre>
  
  <p>and then there's <code>markets/src/markets/CMakeLists.txt</code></p>
  
  <pre><code>cmake_minimum_required(VERSION 3.10)
  project(markets)### C CXX)
  
  set(SOURCE_FILES
      data_handlers.h
      data_handlers.cpp
      data_readers.h
      data_readers.cpp
      execution_handler.h
      execution_handler.cpp
      fill.h
      fill.cpp
      instrument.h
      instrument.cpp
      market_bar.h
      market_bar.cpp
      market_snapshot.h
      market_snapshot.cpp
      order.h
      order.cpp
      pnl_calculator.h
      pnl_calculator.cpp
      portfolio.h
      portfolio.cpp
      position_summary.h
      position_summary.cpp
  )
  
  #set(Boost_USE_STATIC_LIBS OFF)
  #set(Boost_USE_MULTITHREADED ON) # maybe off?
  #set(Boost_USE_STATIC_RUNTIME OFF)
  
  find_package(Boost 1.65.1 REQUIRED COMPONENTS system filesystem)
  find_package (Eigen3 3.3 REQUIRED NO_MODULE)
  find_library(mysqlcppconn 1.1.12 REQUIRED)
  
  include_directories(${Boost_INCLUDE_DIRS})
  link_directories( ${Boost_LIBRARY_DIRS})
  
  add_library(markets SHARED STATIC ${SOURCE_FILES})
  target_link_libraries(markets Eigen3::Eigen mysqlcppconn, ${Boost_LIBRARIES})
  
  # not sure if i need this
  target_link_libraries( markets ${Boost_FILESYSTEM_LIBRARY}, ${Boost_SYSTEM_LIBRARY})
  
  install(TARGETS markets DESTINATION ${MARKETS_INSTALL_LIB_DIR})
  </code></pre>
  
  <p>I'm pretty sure this file that it's complaining about exists, so I'm not sure what to do:</p>
  
  <pre><code>taylor@taylor-XPS-13-9365:~$ stat /usr/lib/x86_64-linux-gnu/libboost_filesystem.so
    File: /usr/lib/x86_64-linux-gnu/libboost_filesystem.so -&gt; libboost_filesystem.so.1.65.1
    Size: 29          Blocks: 0          IO Block: 4096   symbolic link
  Device: 10302h/66306d   Inode: 17184887    Links: 1
  Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
  Access: 2019-09-24 11:11:06.384111528 -0400
  Modify: 2018-03-06 05:21:23.000000000 -0500
  Change: 2019-09-24 11:10:45.160636771 -0400
   Birth: -
  </code></pre>