Skip to content

cmake: "target links to: lsqcpp::lsqcpp but the target was not found" #10

Description

@trufanov-nok

Hi,
I've just tried to link lsqcpp. According to the readme it requires installation (installed to /usr) and

find_package(lsqcpp REQUIRED)
add_executable(myproject main.cpp)
target_link_libraries(myproject lsqcpp::lsqcpp)

But this leads to error:

-- Configuring done
CMake Error at myproject/CMakeLists.txt:22 (target_link_libraries):
  Target "myproject" links to:

    lsqcpp::lsqcpp

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

In lsqcpp/lsqcpp-config.cmake I can see following:

    add_library(lsqcpp INTERFACE)
    target_include_directories(lsqcpp INTERFACE "${lsqcpp_INCLUDE_DIR}")
    target_link_libraries(lsqcpp INTERFACE Eigen3::Eigen)
    add_library(lsqcpp::lsqcpp ALIAS lsqcpp)

So instead of target_link_libraries(myproject lsqcpp::lsqcpp) I tried just target_link_libraries(myproject lsqcpp) - it works.
I'm not a cmake expert, could you doublecheck if readme instructions are still actual?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions