Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
539 stars 47 forks source link

Don't include test targets if disabled #37

Closed wak-google closed 4 years ago

wak-google commented 4 years ago

@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

Naios commented 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.

wak-google commented 4 years ago

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.

Naios commented 4 years ago

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?

wak-google commented 4 years ago

Done

Naios commented 4 years ago

Perfect, thanks!