#Unable to find a library in CMakeLists.txt even after specifying path.

15 messages · Page 1 of 1 (latest)

zenith zealot
#
cmake_minimum_required(VERSION 3.16)
project(telemetry_streamer)
set(CMAKE_CXX_STANDARD 20)

set(Crow_DIR "/usr/local/lib/cmake/Crow")
find_package(Crow REQUIRED)

add_executable(telemetry_streamer src/rest/rest_service.cpp src/rest/crow_rest.cpp)
include_directories(include)

find_package(Boost REQUIRED COMPONENTS system thread filesystem)

target_link_libraries(telemetry_streamer PRIVATE Crow::Crow Boost::system Boost::thread Boost::filesystem)

I'm getting the rror

CMake Warning at CMakeLists.txt:9 (find_package):
  By not providing "FindCrow.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Crow", but
  CMake did not find one.

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

    CrowConfig.cmake
    crow-config.cmake

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

but

root@DESKTOP-URJT285:/usr/local/lib/cmake/Crow# ls
CrowConfig.cmake  CrowTargets.cmake  Findasio.cmake

it exists in this directory. so what am I doing wrong?

wanton swallowBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

magic oak
#

you need to add the directory to the CMAKE_MODULE_PATH for find_package to find your module.

list(APPEND CMAKE_MODULE_PATH "/usr/local/lib/cmake/Crow")
find_package(Crow REQUIRED)
zenith zealot
wanton swallowBOT
#

This question is being automatically marked as stale.
If your question has been answered, run !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.

sweet hornet
#

you want it to find CrowConfig.cmake in there

#

which means you're doing a CONFIG mode find_package

#

which looks in CMAKE_PREFIX_PATH, not CMAKE_MODULE_PATH

zenith zealot
#

i changed my compiler from clang-14 to gcc and it compiled without issues

#

i dont know why

#

it solved a whole range of issues for me. for some reason compiling with clang-14 was not generating debug symbols in my program

#

but changing to gcc worked

#

really weird