mailio icon indicating copy to clipboard operation
mailio copied to clipboard

CMake Error when using with vcpkg

Open ParticleG opened this issue 1 year ago • 8 comments

Reproduce repo: Studio26F vcpkg.json:

{
  "name": "studio26f",
  "version-string": "1.0.0",
  "maintainers": [
    "Particle_G <[email protected]>"
  ],
  "description": "The new centralized backend for the block stacking game <Techmino>",
  "homepage": "https://github.com/26F-Studio/Studio26F",
  "documentation": "https://github.com/26F-Studio/Studio26F",
  "license": "LGPL-3.0",
  "dependencies": [
    "cryptopp",
    {
      "name": "drogon",
      "default-features": false,
      "features": [
        "ctl",
        "orm",
        "postgres",
        "redis"
      ]
    },
    "mailio",
    "magic-enum",
    "range-v3"
  ]
}
CMake Error at cmake-build-debug/vcpkg_installed/x64-windows/share/mailio/mailioConfig.cmake:61 (set_target_properties):
  The link interface of target "mailio" contains:

    Boost::system

  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.

Call Stack (most recent call first):
  vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  CMakeLists.txt:35 (find_package)


CMake Generate step failed.  Build files cannot be regenerated correctly.
ninja: error: rebuilding 'build.ninja': subcommand failed

ParticleG avatar Aug 04 '24 01:08 ParticleG

Does it work when directly consumed from Vcpkg? Because the Microsoft CI/CD worked fine for the version 0.23.

karastojko avatar Aug 05 '24 04:08 karastojko

I'm currently using vcpkg as a submodule, and I havn't tried with an empty vcpkg.json which has mailio as the only one dependency. Would try that out.

ParticleG avatar Aug 05 '24 15:08 ParticleG

Hi, @ParticleG Have you solve this problem?

hotaery avatar Aug 26 '24 08:08 hotaery

modify CMakeLists.txt from

find_package(mailio CONFIG REQUIRED)

to

find_package(boost_system CONFIG REQUIRED)
find_package(boost_date_time CONFIG REQUIRED)

find_package(mailio CONFIG REQUIRED)

fix my problem

hotaery avatar Aug 27 '24 07:08 hotaery

Can you check whether https://github.com/karastojko/mailio/pull/193 and https://github.com/karastojko/mailio/pull/199 fixed the issue? Use v0.25.1 for that.

The new file should solve the issue https://github.com/karastojko/mailio/blob/c85e0632caac8c144b8e85f68bc74966249ccace/cmake/mailio-config.cmake.in.

Spixmaster avatar May 09 '25 06:05 Spixmaster

I guess I have to create PR to Vcpkg for the version 0.25.1.

karastojko avatar May 11 '25 19:05 karastojko

I had a similar issue and here's how I solved it:

  1. The problem might be due to how vcpkg names Boost libraries. For example, boost_system may be named something like boost_system-vc143-mt-x64-1_88.lib, which CMake can't find unless explicitly declared.

  2. When using Boost dynamically, some components like boost-regex might not produce .lib files. You can resolve this by building Boost statically using b2.

In my case, I encountered a linking error while cross-compiling an Electron addon C++ module, and resolving Boost linking manually fixed it.

cocodolong avatar May 31 '25 06:05 cocodolong

The vcpkg port is at 0.25.3 now.

dg0yt avatar Aug 03 '25 11:08 dg0yt