2014-01-02 19:31:53 +00:00
|
|
|
# Test if compile errors are produced where necessary.
|
|
|
|
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
|
|
|
|
2014-01-07 16:43:53 +00:00
|
|
|
function (expect_compile_error code)
|
|
|
|
check_cxx_source_compiles("
|
2014-01-02 19:31:53 +00:00
|
|
|
#include \"format.cc\"
|
2014-01-07 16:43:53 +00:00
|
|
|
int main() {
|
|
|
|
${code}
|
|
|
|
}
|
|
|
|
" compiles)
|
|
|
|
if (compiles)
|
|
|
|
error("No compile error for: ${code}")
|
|
|
|
endif ()
|
2014-01-07 16:57:37 +00:00
|
|
|
unset(compiles CACHE)
|
2014-01-07 16:43:53 +00:00
|
|
|
endfunction ()
|
|
|
|
|
|
|
|
# Writing a wide character to a character stream Writer is forbidden.
|
|
|
|
expect_compile_error("fmt::Writer() << L'a';")
|
2014-01-07 16:57:37 +00:00
|
|
|
expect_compile_error("fmt::Writer() << fmt::pad(\"abc\", 5, L' ');")
|