Alexandre Severino
Alexandre Severino

Reputation: 1613

Boost_DIR-NOTFOUND on CMake

I have been facing some problems when trying to configure a project with CMake.

Even though CMake seems to find the needed libs:

Boost version: 1.49.0
Found the following Boost libraries:
  system
  thread
  chrono

It still can't find its root directory:

Boost_DIR-NOTFOUND

I'm using Linux Mint 15 (Olivia). Thanks in advance.

Upvotes: 3

Views: 7229

Answers (1)

ComicSansMS
ComicSansMS

Reputation: 54589

If you want to check whether the search was successful, you need to check the variable Boost_FOUND instead.

find_package(Boost [...])
if(NOT Boost_FOUND)
  message(FATAL_ERROR "Could not find boost!")
endif()

The Boost_DIR variable is only of significance when using Boost's package configuration file (which is currently no longer supported as of Boost 1.54). It is therefore perfectly fine if this value is left in the NOTFOUND state by the find call.

See the documentation for details.

Upvotes: 3

Related Questions