jeremy-rifkin / libassert

The most over-engineered C++ assertion library
MIT License
549 stars 37 forks source link

CMake error when using ASSERT_USE_EXTERNAL_CPPTRACE flag #66

Closed matab99 closed 1 year ago

matab99 commented 1 year ago

When I tried installing libassert (release v1.2.1) using CMake with ASSERT_USE_EXTERNAL_CPPTRACE flag an error occurs after building the library which is raised here: https://github.com/jeremy-rifkin/libassert/blob/56ddd631ccc133d4d25f7b8051371d931783a40b/CMakeLists.txt#L165-L170

The reason this error occurs is that the cpptrace target is not found due to the fact that the actual target name is cpptrace::cpptrace after it is added by find_package: https://github.com/jeremy-rifkin/libassert/blob/56ddd631ccc133d4d25f7b8051371d931783a40b/CMakeLists.txt#L72-L74

After I edited the CMakeLists file locally by changing the target name to cpptrace::cpptrace inside the add_custom_command function I was able to install the library successfully. I think changing the fixed cpptrace value inside this function to some kind of local variable which would contain the valid target name based on ASSERT_USE_EXTERNAL_CPPTRACE flag value should do the trick.

jeremy-rifkin commented 1 year ago

Thanks for reporting this issue and the detailed triage, that sounds like it should work. I can fix it later or would be happy to accept a PR 🙂

jeremy-rifkin commented 1 year ago

Should be fixed now