3

I'm working on a c++ program that uses cmake with conan to compile, and boost 1.7.4. Recently, I started getting: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3.

The program was working fine up until recently, and now just started getting this error.

Here's my cmake code

#find external libraries with Conan
 ----------------------------------------------------------
conan_check(VERSION 1.0.0 REQUIRED)
message(STATUS "Downloading dependency libraries with Conan")

 #The boost dependency is tricky.
 #Need 1.74 for correct behavior, and need options to successfully build on mac
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
     #workaround for https://github.com/conan-io/conan-center-index/issues/4097
    set(CONAN_OPTIONS boost:without_fiber=True boost:without_nowide=True)
else()
    set(CONAN_OPTIONS )
endif()

conan_cmake_run(REQUIRES boost/1.74.0 jsoncpp/[>=1.8.4] eigen/[>=3.3.7] cgal/[>=5.1]
    OPTIONS
        ${CONAN_OPTIONS}
    BUILD missing
    CMAKE_TARGETS
    BASIC_SETUP
    UPDATE)

I believe boost 1.7.4 only supports filesystem v3, is there a way to check my Boost file system version? Any potential fixes would be greatly appreciated.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
wfjohns1
  • 31
  • 2
  • Looks like you are now pulling in a version of boost that is newer than 1.76 which is the last version to use filesystem v3 [https://www.boost.org/doc/libs/1_76_0/libs/filesystem/doc/index.htm](https://www.boost.org/doc/libs/1_76_0/libs/filesystem/doc/index.htm) – drescherjm Aug 17 '22 at 17:36

1 Answers1

5

We're having the same issue. I fixed it (locally) by adding

'boost:filesystem_version = 3'

to our conanfile.py's default options {}. Looks like this recent change to the recipe is the culprit: https://github.com/conan-io/conan-center-index/pull/11988

Nick Monkman
  • 637
  • 4
  • 9
  • This worked perfectly, thank you! For anyone only using conanfile.txt I just added set(CONAN_OPTIONS boost:filesystem_version=3) to fix. – wfjohns1 Aug 18 '22 at 18:50
  • Glad it worked out! Mind marking it as the answer so others can find it more easily? – Nick Monkman Aug 22 '22 at 17:07