Open MyPublicGitHubAcct opened 1 year ago
This appears to be related to this - > https://github.com/catchorg/Catch2/issues/2411
Seems that the easiest thing that can be done currently (at least while developing) is to just remove the catch_discover_tests
step in the CMakeLists file, but I don't know if this is really correct. The post on the CMake gitlab post linked to here https://github.com/catchorg/Catch2/issues/2411#issuecomment-1169398321 makes me think someone is thinking about a better way.
Interesting, haven't run into this... I use CLion (as it provides a consistent interface on macOS/Windows, can use clang-format and is a nicer experience overall).
Not sure what to suggest outside of waiting for the Catch/CMake team to respond...
I use CLion
It seems weird that CLion would do something different with executable signing than Xcode. Or are you not building on an Apple Silicon CPU? If you are, it’d be good to know what specifically in CLion’s build process is different.
In the mean time, the work-around suggested in the Catch2 thread seems to work well. I added this to my CMakeLists.txt
right after set_target_properties(Tests ...)
:
if (CMAKE_GENERATOR STREQUAL Xcode)
add_custom_command(TARGET Tests POST_BUILD VERBATIM
COMMAND codesign --force --timestamp --options runtime --sign SOME_IDENTITY ${CMAKE_BINARY_DIR}/Debug/Tests
)
endif()
Where SOME_IDENTITY
is your signing identity. You can find that with:
security find-identity -v -p codesigning
Replace SOME_IDENTITY
with either the 40-character hex string or the (full!) quoted string that comes after it. If you run this and nothing comes up, these Apple Docs are probably the place to start reading?
And if you don’t want to mess with your cmake file, you could always just manually sign from the command line with something like:
codesign --force --timestamp --options runtime --sign SOME_IDENTITY Builds/Debug/Tests
and then run Tests
from there.
I am getting the error below when building Tests. I saw the same thing when compiling Catch2 v3 tests for a simple Hello World program on the same system (macOS 12.5, Xcode 13.4.1) and wondered how you had solved it. This does not happen on an older system (intel process, macOS 11.x).