Skip to content

cmake compile error regarding mqtt_cppConfig.cmake missing directories #507

@cz-888-888

Description

@cz-888-888

Hi all I'm trying to install this on Ubuntu 24.04.1 LTS and encountered this error when I try to build with cmake. It seems to be a directory reference issue with mqtt_cpp because CMakeList.txt cannot find its configuration file mqtt_cppConfig.cmake and mqtt_cpp-config.cmake. I have modified the master file under /cppagent/CMakeList.txt to refer to this folder set(mqtt_cpp_iface_DIR "/usr/local/lib/cmake/mqtt_cpp_iface") and find_package(mqtt_cpp_iface REQUIRED) on the config file; declared the project and enable C and C++ project(MyProject LANGUAGES CXX C) . the initial error regarding the config file and the current error after I did all those above are pasted below. i hope i'm not getting into a deadlock/loop here.
note: agent_lib is a subdirectory under cppagent and has been added in the master CMakeList.txt file.

initial error:

cppagent$ cmake .
INFO Shared build: OFF
-- Found nlohmann_json: /usr/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.11.3") 
CMake Error at agent_lib/CMakeLists.txt:299 (find_package):
  By not providing "Findmqtt_cpp.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "mqtt_cpp",
  but CMake did not find one.

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

    mqtt_cppConfig.cmake
    mqtt_cpp-config.cmake

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


-- Configuring incomplete, errors occurred!

current error:

~/cppagent$ cmake .
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.74.0") found components: program_options 
INFO Shared build: OFF
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.83.0/BoostConfig.cmake (found version "1.83.0")  
CMake Error at agent_lib/CMakeLists.txt:299 (find_package):
  By not providing "Findmqtt_cpp.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "mqtt_cpp",
  but CMake did not find one.

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

    mqtt_cppConfig.cmake
    mqtt_cpp-config.cmake

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


-- Configuring incomplete, errors occurred!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions