Closed cottsay closed 3 years ago
I've seen this technique before but I wonder why it's preferred. You are essentially auto-disabling tests if they can't be compiled. Gmock and gtest have multiple ways to be looked up on any system, last time I checked there were 4 different methods in catkin to do this. So I'd say the title is a little misleading and would ask why you want to do this...
These macros will not fail if GMock is not available at build time, and will not produce a target under these circumstances. However, the subsequent CMake lines are assuming that the target will exist, and cause CMake to fail if not.
This change makes the packages tolerant to the absence of GMock at build time.
Example failure: