[cmake-developers] The BuildFlags test you attempted last week...

David Cole david.cole at kitware.com
Mon Jul 9 11:35:01 EDT 2012


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.

See the files Tests/CTestConfig/CMakeLists.txt and
Tests/CTestConfig/CTestConfig.cxx for details.

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.

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".

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.


Hope this helps,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120709/fac954d7/attachment.html>


More information about the cmake-developers mailing list