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

Potential Cmake issue. Not able to get secondary dependency when including in own helloworld-app #119

Open
bratne opened this issue Oct 30, 2022 · 1 comment

Comments

@bratne
Copy link

bratne commented Oct 30, 2022

I trying to include program_options in a simple testapp, by using CMake.

include(FetchContent)
FetchContent_Declare (
    boost_program_options
    GIT_REPOSITORY https://github.com/boostorg/program_options.git   
    GIT_TAG boost-1.80.0
)
FetchContent_MakeAvailable(boost_program_options)
add_executable(helloworld main.cpp)
target_link_libraries(helloworld PRIVATE boost_program_options) 

Trying to build this yields

[cmake] CMake Error at CMakeLists.txt:15 (add_executable):
[cmake]   Target "helloworld" links to target "Boost::any" but the target was not
[cmake]   found.  Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake]   an ALIAS target is missing?
@ngunderson
Copy link

ngunderson commented Jul 21, 2023

Boost::any is a separate library/target than program_options. You could add fetching https://github.com/boostorg/any.git to retrieve this target, though you may end up needing another library that Boost Program Options also depends on. You could instead try fetching the super project boost repository than has all Boost libraries, https://github.com/boostorg/boost. This will give you all Boost libraries, but you should still only have access to and build the explicit targets you link to, like (Boost::program_options).

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

No branches or pull requests

2 participants