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

CMake is not able to find boost components using wt-config.cmake #160

Merged
merged 1 commit into from
Jan 15, 2020

Conversation

StefanRommel
Copy link
Contributor

@StefanRommel StefanRommel commented Jan 10, 2020

The expression

find_package(Boost QUIET COMPONENTS "@Boost_COMPONENTS@")

results in

find_package(Boost QUIET COMPONENTS "program_options;filesystem;thread")

according to the CMake documentation [1] and [2] is a list with one entry "program_options;filesystem;thread" and CMake is unable to find the component "program_options;filesystem;thread"

The correct form is

find_package(Boost QUIET COMPONENTS program_options;filesystem;thread)

Then CMake interprets program_options;filesystem;thread as a list with three entries.

[1] https://cmake.org/cmake/help/latest/command/find_package.html?highlight=components
[2] https://cmake.org/cmake/help/latest/command/list.html

Simple explanation:
The expression
```
find_package(Boost QUIET COMPONENTS "@Boost_COMPONENTS@")
```
results in
```
find_package(Boost QUIET COMPONENTS "program_options;filesystem;thread")
```
according to the CMake documentation [1] and [2] is a list with one entry `"program_options;filesystem;thread"` and CMake is unable to find the component `"program_options;filesystem;thread"`

The correct form is
```
find_package(Boost QUIET COMPONENTS program_options;filesystem;thread)
```
Then CMake interprets `program_options;filesystem;thread` to a list with three entries.

[1] https://cmake.org/cmake/help/latest/command/find_package.html?highlight=components
[2] https://cmake.org/cmake/help/latest/command/list.html
@emweb
Copy link
Collaborator

emweb commented Jan 13, 2020

When I test this, both ways seem to work just fine. Do you have some way to reproduce the issue you're experiencing?

Regards,
Roel

@StefanRommel
Copy link
Contributor Author

I've written a simple CMakeLists.txt:

cmake_minimum_required (VERSION 3.16)
project (HELLO)

find_package(Boost QUIET COMPONENTS "program_options;filesystem;thread")

message("Boost version is ${Boost_VERSION_STRING}")

and the output is:

-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/lib64/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component):
  boost_find_component Macro invoked with incorrect arguments for macro
  named: boost_find_component
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /usr/lib64/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component):
  boost_find_component Macro invoked with incorrect arguments for macro
  named: boost_find_component
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /usr/lib64/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component):
  boost_find_component Macro invoked with incorrect arguments for macro
  named: boost_find_component
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  CMakeLists.txt:4 (find_package)


Boost version is 1.71.0
-- Configuring incomplete, errors occurred!
See also "/home/stefan/Desktop/src/build/CMakeFiles/CMakeOutput.log".

The issue occurs on archlinux [1] with Boost-Libs Version 1.71.0 and CMake Version 3.16.2

[1] https://www.archlinux.org/

@emweb
Copy link
Collaborator

emweb commented Jan 15, 2020

Thanks, I'll check it out. I was checking by changing wt-config.cmake with CMake 3.16.2 and Boost 1.72, and not noticing any issues.

@emweb emweb merged commit 4728a79 into emweb:master Jan 15, 2020
@emweb
Copy link
Collaborator

emweb commented Jan 15, 2020

For some reason I really had to try it on arch to see the same problem. It was just working on Ubuntu 18.04, when using a binary download of CMake 3.16.2 and building Boost 1.71.0 from source.

@Becheler
Copy link

Becheler commented Jul 24, 2020

Thank you for reporting this issue, I bumped into the same type of error for my own project and without your posts I would have had a hard time figuring out what was happening 👍 (Ubuntu 20.04, cmake 3.18 from snap, and boost 1.71)
You saved my night !

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