EQUAL is meant for exact numeric equal comparison (i.e. -- works with numbers only, not meant to work with booleans)
One possibility is: if(_COMPILE_RESULT) set(_COMPILE_RESULT 1) else() set(_COMPILE_RESULT 0) endif() if(SHOULD_COMPILE) set(SHOULD_COMPILE 1) else() set(SHOULD_COMPILE 0) endif() if(_COMPILE_RESULT EQUAL SHOULD_COMPILE) ... Or make new tmp vars if you can't adjust the vars in-the-same-name like that... On Thu, Aug 2, 2012 at 6:49 PM, Rolf Eike Beer <[email protected]> wrote: > I have 2 variables that hold boolean values. One is the result of a > try_compile() and the other has the expected outcome. Now I want to check if > the expectation is correct, so I tried: > > if (_COMPILE_RESULT EQUAL SHOULD_COMPILE) > > Which works if both are true or different, but the result is "false" if both > variables are false, too. I played around with expanding the variables or > quoting, but no change. The only way I got the expected result was this: > > if (_COMPILE_RESULT EQUAL SHOULD_COMPILE OR (NOT _COMPILE_RESULT) EQUAL (NOT > SHOULD_COMPILE) > > This is not really what I would have expected. Is there a less ugly way to get > the expected result? > > Eike > -- > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
