Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Boost libraries individually in CMake per docs #1024

Closed
wants to merge 1 commit into from

Conversation

YakoYakoYokuYoku
Copy link
Member

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. Additionally, make sure you've done all of these things:

PR Description

What type of PR is this? (Check one of the boxes below)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change which does not add functionality nor fixes a bug but improves Natron in some way)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
    • I have updated the documentation accordingly

What does this pull request do?

This fixes an annoying policy warning when using CMake. Referencing libraries directly with find_package has been supported way back in Boost.

Show a few screenshots (if this is a visual change)

N/A.

Have you tested your changes (if applicable)? If so, how?

By building and running Natron.

Futher details of this pull request

This might fix issues in other platforms such as BSD related to include directories.

@YakoYakoYokuYoku
Copy link
Member Author

@Martinfx, can you try this PR to see if it does the trick in FreeBSD?

@Martinfx
Copy link

@Martinfx, can you try this PR to see if it does the trick in FreeBSD?

I tested your branch on FreeBSD and this is result

maxfx@hades2 ~/D/Natron (boost-cmake-libs)> cmake .
-- The CXX compiler identification is Clang 18.1.6
-- The C compiler identification is Clang 18.1.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'RelWithDebInfo' as none was specified.
CMake Error at CMakeLists.txt:55 (find_package):
  By not providing "Findboost_headers.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "boost_headers", but CMake did not find one.

  Could not find a package configuration file provided by "boost_headers"
  with any of the following names:

    boost_headersConfig.cmake
    boost_headers-config.cmake

  Add the installation prefix of "boost_headers" to CMAKE_PREFIX_PATH or set
  "boost_headers_DIR" to a directory containing one of the above files.  If
  "boost_headers" provides a separate development package or SDK, be sure it
  has been installed.


@Martinfx
Copy link

@YakoYakoYokuYoku You try to add (if else) for FreeBSD and for Linux

@YakoYakoYokuYoku
Copy link
Member Author

Can you check for both of boost_headers and boost_serialization in your lib/cmake directory? Both of them are in the devel/boost-libs plist, either you don't have those files or FreeBSD does something else for libraries that use CMake.

@Martinfx
Copy link

Can you check for both of boost_headers and boost_serialization in your lib/cmake directory? Both of them are in the devel/boost-libs plist, either you don't have those files or FreeBSD does something else for libraries that use CMake.

I am sorry my mistake. I have new installation OS. It is ok.

@devernay
Copy link
Member

devernay commented Dec 20, 2024

@YakoYakoYokuYoku I can't find the doc saying that this is the proper way to use boost from cmake.
My BoostConfig.cmake (boost 1.86.0) still contains:

# A typical use might be
#
# find_package(Boost 1.70 REQUIRED COMPONENTS filesystem regex PATHS C:/Boost)

Can you please give us a pointer?
I have the lib/cmake/boost_headers-1.86.0/boost_headers-config.cmake file, but I just can't find the doc that mentions the proper way to use boost

@YakoYakoYokuYoku
Copy link
Member Author

It's way down below in the boostorg/cmake README, seems that when I was copying it I've omitted the fragment, drats.

@acolwell
Copy link
Collaborator

acolwell commented Dec 21, 2024

It's way down below in the boostorg/cmake README, seems that when I was copying it I've omitted the fragment, drats.

My read of that section isn't that this is the preferred method, its just that is how you had to do things if you were using a version before 1.82. It looks like most FreeBSD installs should be above this threshold so what we have should be ok.

@Martinfx when you say "I am sorry my mistake. I have new installation OS. It is ok." does this mean you did something and now you are able to build? Can you build now with the original code or do you still need a change like this?

@Martinfx
Copy link

Martinfx commented Dec 21, 2024

It's way down below in the boostorg/cmake README, seems that when I was copying it I've omitted the fragment, drats.

My read of that section isn't that this is the preferred method, its just that is how you had to do things if you were using a version before 1.82. It looks like most FreeBSD installs should be above this threshold so what we have should be ok.

@Martinfx when you say "I am sorry my mistake. I have new installation OS. It is ok." does this mean you did something and now you are able to build? Can you build now with the original code or do you still need a change like this?

It is ok. I installed a package boost-libs.I am able to build natron.

@acolwell
Copy link
Collaborator

It's way down below in the boostorg/cmake README, seems that when I was copying it I've omitted the fragment, drats.

My read of that section isn't that this is the preferred method, its just that is how you had to do things if you were using a version before 1.82. It looks like most FreeBSD installs should be above this threshold so what we have should be ok.
@Martinfx when you say "I am sorry my mistake. I have new installation OS. It is ok." does this mean you did something and now you are able to build? Can you build now with the original code or do you still need a change like this?

It is ok. I installed a package boost-libs.I am able to build natron.

Ok. @Martinfx please close your pull request then and I suggest we close this one as well.

@YakoYakoYokuYoku
Copy link
Member Author

This has to be merged, as CMP0167 is emitted still.

CMake Warning (dev) at CMakeLists.txt:55 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

@acolwell
Copy link
Collaborator

This has to be merged, as CMP0167 is emitted still.

CMake Warning (dev) at CMakeLists.txt:55 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

So if you look at the documentation for CMP0167 it does not recommend your fix. It looks like the proper fix is to add CONFIG to the existing line (i.e. find_package(Boost CONFIG COMPONENTS headers serialization) )

@acolwell
Copy link
Collaborator

find_package(Boost CONFIG COMPONENTS headers serialization)

Actually after looking at the full find_package() signature it looks like it should be

find_package(Boost COMPONENTS headers serialization CONFIG)

@YakoYakoYokuYoku
Copy link
Member Author

In the boostorg/cmake README they don't mention CONFIG but BoostConfig.cmake, so we have to choose between the two options, probably we should go as you say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants