Files
opm-core/cmake/Modules/FindC99.cmake
Roland Kaufmann 2fc5a6349e Probe for C99 standard available
Similar to the -std=c++0x flag for C++ code, we probe for, and add if
available, -std=c99 for C code, since the compiler may generate
different initialization code for this variant.

The reporting from the bundled CMake modules is not as polished as for
probing for C++ flags, but not bad enough to warrant rewriting the code
from scratch just to fix the output.
2013-02-11 22:37:55 +01:00

26 lines
625 B
CMake

# - Module that checks for supported C99 features.
# macro to only add option once
include (AddOptions)
# try to use compiler flag -std=c99
set (C_STD99_FLAGS "-std=c99")
# incidently, the C++ test is so simple that it can be used to compile C as well
include (CheckCCompilerFlag)
check_c_compiler_flag (${C_STD99_FLAGS} HAVE_C99)
# add option if we are capable
if (HAVE_C99)
add_options (C ALL_BUILDS "${C_STD99_FLAGS}")
else (HAVE_C99)
set (C_STD99_FLAGS)
endif (HAVE_C99)
# handle quiet and required
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (C99
DEFAULT_MSG
C_STD99_FLAGS
)