bloomberg / clangmetatool

A framework for reusing code in Clang tools
https://bloomberg.github.io/clangmetatool/
Apache License 2.0
119 stars 25 forks source link

clangmetatool fails if it can't find gtest #38

Closed LegalizeAdulthood closed 5 years ago

LegalizeAdulthood commented 5 years ago

Describe the bug Missing gtest causes clangmetatool to fail to build

To Reproduce Steps to reproduce the behavior:

  1. Clone clangmetatool
  2. Configure a build with cmake without gtest on your system
  3. clangmetatool fails to configure

Expected behavior I should be able to build and install clangmetatool without building and running the gtest test suite

Environment (please complete the following information):

Additional context The workaround is to simply comment out the bottom of the CMakeLists.txt where it looks for gtest and adds the test subdirectory.

Suggested fix is to look for gtest as a non-required package and if found add the test directory.

dbeer1 commented 5 years ago

How about something like -DBUILD_TESTING=ON/OFF to enable/disable testing. Rather than just have tests turn themselves off, if you build with testing on then you need to have gtest installed, if testing is off then it won't try to build them

dbeer1 commented 5 years ago

https://cmake.org/cmake/help/latest/module/CTest.html