You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have add_example_test() separated from add_example_executable() enables more testing command-lines being added for each single example. And having the add_example_test() enables the developer to use one example .cpp and executable to support multiple testing cases from the example, which saves compiling time and makes development easier.
I think CMake does the equivalent thing under the hood. It resolves target dependency and reuses build cache where possible, so it doesn't rebuild the same binary more than once. Can you find a counter-example?
I think I get what you mean now. Doing so does produce 2 executables and doubles compilation time. I was using ccache so I got the wrong impression that CMake will avoid compiling twice.
So yeah I agree this is lacking. But I lean more toward that add_example_executable by default will be run by CTest. And we add extra helper function to add extra test params for the example code.
Have add_example_test() separated from add_example_executable() enables more testing command-lines being added for each single example. And having the add_example_test() enables the developer to use one example .cpp and executable to support multiple testing cases from the example, which saves compiling time and makes development easier.
The CMakeLists.txt will be like the following:
The text was updated successfully, but these errors were encountered: