On 09.07.2012 17:35, David Cole wrote:
Not sure what your main goal was for that test, but a similar test already 
exists to ensure proper definition of

http://www.cmake.org/Bug/view.php?id=13069

Seems there is no test which checks if -DCMAKE_BUILD_TYPE=XXX triggers the 
selection of the matching CMAKE_C_FLAGS_XXX:

CMakeLists: set(CMAKE_C_FLAGS_DEBUG -DTEST_STRING="${CMAKE_BUILD_TYPE}"
main.c    : printf("%s\n", TEST_STRING)
test      : output == ${CMAKE_BUILD_TYPE}

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

--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to