couchbase-lite-core icon indicating copy to clipboard operation
couchbase-lite-core copied to clipboard

CMake: Fixed duplicate compilation of source files

Open snej opened this issue 1 year ago • 3 comments

When the option LITECORE_BUILD_TESTS is on (as it is by default), all the LiteCore source files were compiled twice: once in the regular LiteCoreObjects target and once in LiteCoreUnitTesting. The latter target has the preprocessor symbol LITECORE_CPPTEST defined.

I've removed the LiteCoreUnitTesting target. Instead, LITECORE_CPPTEST is now defined whenever LITECORE_BUILD_TESTS is on. This means that release builds should use LITECORE_BUILD_TESTS=OFF. If they don't, CMake will issue a warning.

I also made LITECORE_BUILD_TESTS default to OFF in release builds.

On my MacBook Pro this improved debug build times by ~30%.

snej avatar Sep 19 '24 16:09 snej