cmake: Add CURL_BUILD_TESTING option#6036
Conversation
To let the top level project decide whether to enable the curl tests when curl is a subproject.
|
I understand the idea and I even think curls CMake should introduce more project-specific switches to control standard features exactly to give control to top-level projects. However, I don't like that if you set the CURL_BUILD_TESTING, the build is still allowed to complete without error even though perl may not be there. Similarly, if you set CURL_BUILD_TESTING=NO but curl is top-level project, it gets ignored. |
As it currently is if you set the BUILD_TESTING, the build is still allowed to complete without error even though perl may not be there. I'm fine changing it, but AFAICT it would require changes I'm not sure everybody would agree to. Would everybody agree to:
? So
|
Meh, I haven't checked the tests/CMakeLists.txt... At least that's how I see it. Anyone else is welcome to chime in. |
The problem is that the CTest Module has all but standardized |
|
Yeah, I know. The same is with few other variables. The problem begins when a project is included via So what about turning it all around and using |
As I see it it's such a common practice that not supporting it is a bug.
Playing with CACHE variables in that way scares me, specially with something like BUILD_TESTING. Are you suggesting using set() with I would still go for #6036 (comment). Yes, there are two variables, but:
|
|
You make valid points. I would still kinda prefer the negative "DISABLE" variable but maybe it's just me being weird ;). I'd really appreciate another voice in this discussion. @Lekensteyn ? @bagder ? |
|
I trust your hunch more than mine on this @jzakrzewski. I have almost zero experience with cmake and I can't judge which of these options makes the best end solution! |
|
@jzakrzewski @reddwarf69 +1 for One possible solution is to use cmake_dependent_option |
|
At the end I am using the autotools build so I'm not going to be spending time on this any time soon. |
CMake will now handle BUILD_TESTING depending on PERL_FOUND and CURL_DISABLE_TESTING Ref: curl#6036
curl builds tests with CMake when explicitly building the `testdeps` target. It's not built by default. It seems overkill to have a curl-specific variant of this (over CMake's `BUILD_TESTING`) to disable generating this target. Its history also doesn't make it obvious why this was necessary, and there was a long debate how to do it, by the time the original submitter abandoned CMake. The option also remained uninitialized and thus undocumented. Let me know if I missed something. Ref: #6036 Ref: 3a1e798 #6072 Closes #16134
`BUILD_TESTING` variable is used by other projects and CMake internally. Replace `cmake_dependent_option()` with `option()` and introduce an internal variable to track if want and can do testing. Follow-up to curl#6036 Follow-up to 3a1e798 curl#6072 Reported-by: Robert Maynard Fixes curl#15351 Closes curl#15355
curl builds tests with CMake when explicitly building the `testdeps` target. It's not built by default. It seems overkill to have a curl-specific variant of this (over CMake's `BUILD_TESTING`) to disable generating this target. Its history also doesn't make it obvious why this was necessary, and there was a long debate how to do it, by the time the original submitter abandoned CMake. The option also remained uninitialized and thus undocumented. Let me know if I missed something. Ref: curl#6036 Ref: 3a1e798 curl#6072 Closes curl#16134
To let the top level project decide whether to enable the curl tests
when curl is a subproject.