Closed kevans91 closed 6 years ago
I don't think that this is the correct approach. I'd prefer for the default value of ENABLE_TESTS
to be true if we're doing a debug build.
I don't see the cache property on this. Can you confirm that if you do a debug build and disable tests then the next time you run cmake .
tests remain disabled?
Sorry, just saw this- indeed, the following sequence leaves tests disabled until you explicitly re-enable them:
mkdir dist
cd dist
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=OFF ..
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake ..
I believe setting the cache attribute on the variable should fix this. Create a DEFAULT_TESTS
variable that is true for debug builds and false for release and then initialise a cached ENABLE_TESTS
variable with $DEFAULT_TESTS
.
Wait, fix what? I thought it was supposed to remain disabled until you manually tweaked iy.- which is what it does.
Sorry, I misunderstood. To clarify, what happens if I do:
cmake .. -DCMAKE_BUILD_TYPE=Debug
ccmake . # and toggle ENABLE_TESTS to OFF
cmake .
If ENABLE_TESTS
remains off, that's fine and I'll merge.
When you say # and toggle ENABLE_TESTS to OFF
, do you mean -DENABLE_TESTS=OFF, or toggling it manually in CMakeCache.txt? Either one will result in ENABLE_TESTS staying off while it's still a debug build.
I mean, in the ccmake UI.
D'oh, TIL that ccmake
is actually the name of a binary and not a typo, and cmake
has a UI. =D
Indeed, ENABLE_TESTS
remains off with that sequence of events as well.
This has made development much better on my end, only having to remember to enable debug to include the tests. I've made it ignore ENABLE_TESTS since I've not yet found a reason that I'd want a debug build with tests explicitly turned off.