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

Fixed #989. #990

Merged
merged 2 commits into from
Nov 14, 2023
Merged

Fixed #989. #990

merged 2 commits into from
Nov 14, 2023

Conversation

redboltz
Copy link
Owner

Removed boost system and date_time from dependency.

Removed boost system and date_time from dependency.
@lproj
Copy link

lproj commented Nov 13, 2023

This works now with this CMakeLists.txt (I've installed mqtt_cpp#fix_989):

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(CPMExampleBoost)

# ---- Create binary ----

add_executable(CPMExampleBoost main.cpp)
target_compile_features(CPMExampleBoost PRIVATE cxx_std_17)

# ---- Dependencies ----

file(
  DOWNLOAD
  https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.3/CPM.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
  EXPECTED_HASH SHA256=cc155ce02e7945e7b8967ddfaff0b050e958a723ef7aad3766d368940cb15494
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)

CPMAddPackage(
  NAME Boost
  VERSION 1.81.0
  GITHUB_REPOSITORY "boostorg/boost"
  GIT_TAG "boost-1.81.0"
)

set(MQTT_BUILD_EXAMPLES OFF CACHE BOOL "build mqtt_cpp examples" FORCE)
set(MQTT_BUILD_TESTS OFF CACHE BOOL "build mqtt_cpp tests" FORCE)
cpmaddpackage("gh:redboltz/mqtt_cpp#fix_989")

target_link_libraries(CPMExampleBoost PRIVATE Boost::asio)

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #990 (dc90578) into master (070c25a) will decrease coverage by 5.37%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #990      +/-   ##
==========================================
- Coverage   84.13%   78.77%   -5.37%     
==========================================
  Files          65       65              
  Lines       10749    10402     -347     
==========================================
- Hits         9044     8194     -850     
- Misses       1705     2208     +503     

@redboltz redboltz merged commit ac2d324 into master Nov 14, 2023
24 of 25 checks passed
@redboltz redboltz deleted the fix_989 branch November 14, 2023 01:22
@lproj
Copy link

lproj commented Nov 16, 2023

Sorry to bother you again, but I am getting this error now when trying with master. I think it's a CPM limit:

CMake Error at /home/me/build/_deps/mqtt_cpp-src/include/CMakeLists.txt:62 (ADD_LIBRARY):
Target "check_deps" links to target "Boost::boost" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
CMake process exited with exit code 1.

As a work-around I first have to define the Boost::boost target before installing mqtt_cpp:

add_library(Boost::boost INTERFACE IMPORTED)
target_include_directories(Boost::boost INTERFACE "${Boost_SOURCE_DIR}")

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

Successfully merging this pull request may close these issues.

2 participants