| | 1 | = CMake Macro Reference: `boost_test_compile_fail` = |
| | 2 | |
| | 3 | The `boost_test_compile_fail` macro creates a Boost regression test that will be compiled, |
| | 4 | but compilation should fail. It is used to test, e.g., that certain |
| | 5 | disallowed syntax does in fact cause a compilation failure. |
| | 6 | |
| | 7 | {{{ |
| | 8 | boost_test_compile_fail(testname |
| | 9 | [source1] |
| | 10 | [COMPILE_FLAGS compileflags]) |
| | 11 | }}} |
| | 12 | |
| | 13 | `testname` is the name of the test. `source1` is the name of the source |
| | 14 | file that will be built. If no source file is provided, the file |
| | 15 | "testname.cpp" will be used instead. |
| | 16 | |
| | 17 | The `COMPILE_FLAGS` argument provides additional arguments that will |
| | 18 | be passed to the compiler when building this test. |
| | 19 | |
| | 20 | == Example == |
| | 21 | The following invocation of the `boost_test_compile_fail` macro introduces a regression test that will attempt to compile `function_test_fail1.cpp`. The compilation should produce some error messages, in which case the regression test has succeeded. |
| | 22 | |
| | 23 | {{{ |
| | 24 | boost_test_compile_fail(function_test_fail1) |
| | 25 | }}} |
| | 26 | |
| | 27 | This example is from [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/libs/function/test/CMakeLists.txt libs/function/test/CMakeLists.txt]. |
| | 28 | |
| | 29 | == Where Defined == |
| | 30 | This macro is defined in the Boost Testing module in [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostTesting.cmake tools/build/CMake/BoostTesting.cmake] |