hyperscan icon indicating copy to clipboard operation
hyperscan copied to clipboard

cmake/boost.cmake: fixes search path for (linked) boost package if build in sub-directory

Open sebres opened this issue 4 years ago • 0 comments

Rationales

If one try to build hyperscan in a sub-directory, and boost is linked to include, as it is described in Getting started, one may get an error that boost package is not found:

$ cd /path/to/hyperscan
$ ln -s /path/to/boost ./include/boost
$ mkdir build/Release_x64; cd build/Release_x64
$ cmake -S ../.. -B .
...
CMake Error at cmake/boost.cmake:23 (message):
  Boost 1.57.0 or later not found.  Either install system packages if
  available, extract Boost headers to /path/to/hyperscan/include, or
  set the CMake BOOST_ROOT variable.
...
-- Configuring incomplete, errors occurred!

Note: it seems to be affected only if one uses cmake not in project root directory... for instance like devs doing it often to hold Debug/Release/etc and platforms related (x64/x86) builds in different locations.

This PR proposes a fix for that - it would take a look into include/boost before include.

Toolchain and platform details

$ cmake --version
cmake version 3.20.1

$ grep 'Boost VERSION' ../../include/boost/CMakeLists.txt
project(Boost VERSION 1.78.0 LANGUAGES CXX)

$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-pc-msys)

$ systeminfo | grep 'OS '
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19042 N/A Build 19042

sebres avatar Oct 15 '21 13:10 sebres