build SmartExceptionTracer with cmake #2397
Open
+4
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using FOLLY_NO_EXCEPTION_TRACER, we may still want to use GtestHelpers.h, which references SmartExceptionTracer.h. For this to work, we can manually link the
folly_exception_tracer
target like:Without WHOLE_ARCHIVE, the global
initialize
will not be pulled in by linker.Manually tested this with a simple project: folly is configured with
-DGFLAGS_USE_TARGET_NAMESPACE=ON -DFOLLY_NO_EXCEPTION_TRACER=ON
main.cpp:
CMakeLists.txt
Ordering folly_exception_tracer before folly is important. (Maybe flaw of cmake?)
Without linking to folly_exception_tracer: link error
link to folly_exception_tracer without WHOLE_ARCHIVE
So even without FOLLY_NO_EXCEPTION_TRACER, we will need this, because we definitely don't want to specify WHOLE_ARCHIVE for the main folly library.
BTW, ExceptionAbi.h is removed from install. It is copied from libstdc++, and folly should not expose this.
The build script of exception_tracer have changed many times.
IMO, we should merge the folly_exception_tracer_base to the main lib, so that GtestHelper works out-of-box. It does not have any side-effect if not used. And keep folly_exception_tracer, folly_exception_counter separate lib, because they rely on global initialization and needs specifying WHOLE_ARCHIVE when linking. What do you think?