check_symbol_exists() fails when "-pedantic-errors" is added to CMAKE_C_FLAGS
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Try with this minimal CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
include(CheckSymbolExists)
set(CMAKE_C_FLAGS "-pedantic-errors")
check_symbol_exists(fwrite stdio.h HAVE_FWRITE)
if (NOT HAVE_FWRITE)
message(FATAL_ERROR "fwrite not available...")
endif()
One workaround is to add -pedantic-errors
to more specific variables like CMAKE_C_FLAGS_DEBUG
or CMAKE_C_FLAGS_RELEASE
.