15 Sep 2025 |
emily | no sense going back in time | 01:43:54 |
Lun | there was a fallthrough for bare msgpack before which didn't add includes properly but would work on FHS | 01:44:06 |
emily | anyway, you can use CMake aliases I think | 01:44:06 |
Lun | * there was a fallthrough for bare msgpack before which didn't add includes properly but would work on FHS (or our magic -isystem stuff) | 01:44:25 |
emily | https://github.com/prusa3d/PrusaSlicer/commit/cc788ebb643b6d4048f3550235ac3e9d3697ada0 | 01:44:35 |
emily | like this kind of thing | 01:44:37 |
emily | or actually | 01:44:45 |
emily | https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries | 01:44:55 |
emily | literally just this | 01:44:58 |
emily | so look for new thing, otherwise look for old thing and alias it to new thing. or define local alias name for it or something. | 01:45:23 |
emily | but also meh | 01:45:28 |
emily | like I think it's nicer than migraphx_msgpack_target | 01:45:51 |
emily | to at least make that a real alias target | 01:45:56 |
Lun | Can I name the alias msgpack or do I need to pick something unique from the three names being find_package()ed? | 01:50:37 |
emily | I would either pick msgpack-cxx (and only define the alias in the fallback cases) or I would name it something that won't collide | 01:57:47 |
emily | the latter is probably more "hygienic" | 01:57:50 |
Lun | ok I think what we want is
find_package(msgpack-cxx CONFIG)
if(msgpack-cxx_FOUND)
message(STATUS "Found msgpack-cxx (>=6.x)")
else()
find_package(msgpackc-cxx REQUIRED NAMES msgpackc-cxx msgpack)
message(STATUS "Found msgpackc-cxx (<=5.x)")
add_library(msgpack-cxx ALIAS msgpackc-cxx)
endif()
target_link_libraries(migraphx PRIVATE msgpack-cxx) …
| 02:09:57 |
emily | I don't think you need/want to force CONFIG | 02:10:35 |
emily | and I am not sure about NAMES there | 02:11:30 |
emily | I think that depends on the structure of how the old versions' CMake modules work | 02:12:08 |
emily | did they maintain compatibility for the < 5.0 versions in the libraries they did fix? | 02:12:26 |
Lun | old structure: https://github.com/msgpack/msgpack-c/blob/6e7deb809120881634b3ca895e66b2a946084f34/msgpack-config.cmake.in
| 02:12:39 |
Lun | so if the comment isn't lying msgpack-config exposes a msgpackc-cxx target in 3.x | 02:13:11 |
emily | I am not convinced NAMES does quite what you want there, but I don't know CMake well enough to be completely certain. | 02:13:55 |
emily | https://github.com/ROCm/rocm-libraries/commit/f86b000fb88bb144fc568d91aeb9b70ea3059125 I guess it is what they are doing already though? so meh | 02:14:36 |
emily | I would just copy what they are doing. at least they can't complain about it. | 02:14:46 |
Lun | lol | 02:15:08 |
emily | I got everything except ROCm working at least. | 02:18:02 |
emily | CMake 4 is really just turning up all the worst crap. | 02:18:26 |
Lun | PRed what I have, if they want it to match rocm-libraries exactly instead of the alias they can ask/ignore me and recreate the PR 9 months later using their own approach and close mine. the alias version you suggested seems nicer so I don't want to go back to copying exactly what the other one does. | 02:22:12 |