bfgroup / Lyra

A simple to use, composable, command line parser for C++ 11 and beyond
https://bfgroup.github.io/Lyra/
Boost Software License 1.0
471 stars 56 forks source link

[CMake problem] LINK : fatal error LNK1104: unable to open file 'bfg::lyra.lib' #43

Closed Tyrben closed 2 years ago

Tyrben commented 3 years ago

I sticked to the instructions written in your CMakeLists.txt which are:

On windows, I get the late link error

LINK : fatal error LNK1104: unable to open file 'bfg::lyra.lib'

Sure, the directory where the lib should be is empty (in my case build\liblyra\Debug).

Is Lyra supposed to build just by adding the add_subdirectory? Because it has its own .sln... which could be a problem I guess.

More info incomming from Linux:

Target "ao-avalonian-roads-gps" links to target "bfg::lyra" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

Tyrben commented 3 years ago

Ok, the solution is very simple, so please correct the help on top of the CMakeLists.txt

add_subdirectory( <path-to-lyra> ) OK but target_link_libraries( <my-exe/lib> PUBLIC bfg::lyra ) No, there are 2 mistakes

resulting on target_link_libraries( <my-exe/lib> LINK_PUBLIC bfg::Lyra )