Closed wak-google closed 4 years ago
Good catch! The if (BUILD_TESTING)
probably should be moved beforeif (MSVC)
since the code below only contains code needed for testing.
Is BUILD_TESTING
automatically enabled or do we need to add it to the CI variables as well?
Probably it should be enabled by default for a master project (if function2 is not included as git submodule) as well.
I think I fixed it up the way you are asking. Those MSVC flags are only used for testing? Anyway BUILD_TESTING defaults to ON when including CTest so CI should be fine.
The MSVC flags need to be set before include(cmake/CMakeLists.txt)
as far as I remind. Probably this has something to do with that the default flags need to be altered on the top level scope. Otherwise things could break. Could you fix this?
Done
Perfect, thanks!
@Naios
What was a problem?
Doing a shallow clone and attempting to build with BUILD_TESTING=OFF doesn't work due to missing files for googletest targets.
How this PR fixes the problem?
By not including any of the test targets if BUILD_TESTING=OFF