One of my co-workers just did a build where they ran cmake with the option 
-DCMAKE_BUILD_TYPE=RelWithDebugInfo  Of course what was obviously meant was 
RelWithDbgInfo.  Because of this incorrect option the build was not as 
expected, but it took a while to figure out why it failed.  Of course once we 
realize the problem it is obvious that they expected to build with 
optimizations, but instead they build with no optimizations. Is there some way 
to make cmake abort when the option is not recognized?  I realize I could add 
any build type, but in this case it doesn't make sense.

The reason the build failed was at some point we have a test that is something 
like this:
        #ifdef DEBUG
                EXPECT_FLOAT_EQ(7.47869, value);
        #else
                EXPECT_FLOAT_EQ(6.19632, value);
        #endif

The code under test was written about 10 years before we even heard of tests, 
and we have years of real world use that shows it works.  Since the algorithms 
are complex in the typical ways of legacy code: nobody has figured out what is 
going on that compiler optimizations can change a floating point value by this 
much.  This test is just a characterization of current behavior so we don't 
accidentally break it if we have to touch it.

I'm also investigating if I can something different in the preprocessor to get 
the information I need, but this is outside the scope of cmake, and it seems 
that cmake should warn me if my build type option is set to something that 
isn't valid.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to