boost-cmake / boost

Cmake-based build of boost
Boost Software License 1.0
58 stars 24 forks source link

Do not even add the testing executables when the tests are disabled. #9

Open dutow opened 6 years ago

dutow commented 6 years ago

The tests are currently targets excluded by the default target, so they aren't built.

But excluded targets are still generated, and created.

This has two results:

I simply reused the BUILD_TESTING option to not even include the test directories if it's not set. As you also used the off setting for some different behavior, I do not think this will be the correct/final solutions to it, but I do think that an option to disable them (and making that a default) would make the project more usable for end users.

pfultz2 commented 6 years ago

Yea, we probably need a way to control whether tests are added or not, I am not sure the best way to do that yet.

One, I would like to be able to have tests be able to run without reconfiguring cmake if the dependencies are satisfied. The is probably only useful in a standalone build where the number of tests are small.

Secondly, I would like to be able to support partial checkouts of boost for building and testing. Someone only wants to test one library, so when BUILD_TESTING=Off, the tests are still added but the test dependencies are ignored if they dont exist.

We also need to support users who will use boost through add_subdirectory and is not concerned about running boost's test suite.

For IDE users, is there some property that can be set to better organize tests when they are shown in the IDE? For developers that are using Boost with tests and an IDE, there should be a better way its presented in the GUI.

dutow commented 6 years ago

The is probably only useful in a standalone build where the number of tests are small.

Yes, I am trying to use this as a subdirectory for building boost libraries in CMake projects, and the tests took far more time up than anything else. And anytime I changed any of my CMakeLists, it ran for several minutes again. In those projects, I am not interested in the results of the boost test suite. With this change, it's just a few seconds.

For IDE users, is there some property that can be set to better organize tests when they are shown in the IDE?

USE_FOLDERS and the FOLDER property. Supports even nested structures with the usual directory separators.

We also need to support users who will use boost through add_subdirectory and is not concerned about running boost's test suite.

This can be checked by using the PARENT_DIRECTORY property.

So maybe use this "do not add the tests by default" behavior if it's a subproject?

ricejasonf commented 6 years ago

I'm very interested in not running tests by default. Most libraries that I've used have an explicit target like make check for this.

My use case is for cross compiling.

Any progress on this?

pfultz2 commented 6 years ago

I'm very interested in not running tests by default. Most libraries that I've used have an explicit target like make check for this.

Thats the exactly how this works. However, the targets are still added, but not to the all target, which lets you run the tests without reconfiguring cmake(like what most projects do).

The issue:

Any progress on this?

I think the solution is to use an ENABLE_TESTS property perhaps with a default value from CMAKE_ENABLE_TESTS variable.