catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.65k stars 3.05k forks source link

Question: When added as subdirectory, CMake more often than not build Catch2. #2893

Closed panwarab closed 1 month ago

panwarab commented 3 months ago

Description When added as a sub-directory, CMake more often than build Catch2 ( which takes some time ) since it's added as a static library. Is it possible to expose Catch2 via dll?

Additional context

[ 90%] Building CXX object libs/Catch2/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_predicate.cpp.o
[ 91%] Building CXX object libs/Catch2/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_quantifiers.cpp.o
[ 92%] Building CXX object libs/Catch2/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_string.cpp.o
[ 92%] Building CXX object libs/Catch2/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_templated.cpp.o
[ 93%] Building CXX object libs/Catch2/src/CMakeFiles/Catch2.dir/catch2/matchers/internal/catch_matchers_impl.cpp.o
[ 94%] Linking CXX static library libCatch2d.a
make[2]: Leaving directory '/home/lightning-mcqueen/repo/codespace/build'
[ 94%] Built target Catch2

Please let me know if you need more context.

horenmar commented 2 months ago

If you are linking the library, it has to be built. If you want to use single build across multiple projects, install it globally and then link against that.

ChrisThrasher commented 1 month ago

Closing this issue as Catch2 already supports static or shared builds as desired by the user.