approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
312 stars 51 forks source link

Building with own {fmt} source tree gives CMake error #136

Closed claremacrae closed 4 years ago

claremacrae commented 4 years ago

If I try building with a CMake project that has already included my own fork or clone of {fmt}, I get this error when CMake/fmt/CMakeLists.txt is loaded:

CMake Error at cmake-build-spaces/cmake-build-command-line/approvaltests.cpp_build/CMake/fmt/fmt-src/CMakeLists.txt:178 (add_library):
  add_library cannot create target "fmt" because another target with the same
  name already exists.  The existing target is a static library created in
  source directory
  "/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/fmt".
  See documentation for policy CMP0002 for more details.

CMake Error at cmake-build-spaces/cmake-build-command-line/approvaltests.cpp_build/CMake/fmt/fmt-src/CMakeLists.txt:223 (add_library):
  add_library cannot create target "fmt-header-only" because another target
  with the same name already exists.  The existing target is an interface
  library created in source directory
  "/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/fmt".
  See documentation for policy CMP0002 for more details.
KartikAiyer commented 12 months ago

I'm running into this same problem when I use Cmake to download the source and then try to add_subdirectory the source folder. Can you tell me how you resolved the issue? I'm seeing this with tagged version 10.0.0