Not sure what your main goal was for that test, but a similar test already exists to ensure proper definition of CMAKE_BUILD_TYPE or proper selection of build configuration in a multi-config generator. But only in the context of running a ctest -D dashboard or a ctest -S dashboard script.<div>
<br></div><div>See the files Tests/CTestConfig/CMakeLists.txt and Tests/CTestConfig/CTestConfig.cxx for details.</div><div><br></div><div>You would need a block for "if(CMAKE_CONFIGURATION_TYPES)" in order to get the logic just right w.r.t. CMAKE_BUILD_TYPE in your test.</div>
<div><br></div><div>The Visual Studio and/or Xcode dashboards that did pass your test, passed it by luck because the built configuration happened to match the CMAKE_BUILD_TYPE that you were trying to "expect".</div>
<div><br></div><div>The important piece of knowledge to have here is that CMAKE_BUILD_TYPE is not defined for multi-config generators, and in fact, it should be considered bad practice, although it's not strictly an error, to define it in such a build tree. Because in a multi-config generator you can actually have multiple builds (Debug+Release+...) existing side-by-side in the same build tree.</div>
<div><br></div><div><br></div><div>Hope this helps,</div><div>David</div><div><br></div>