Features: Extend concept to C language.

Add properties and variables corresponding to CXX equivalents.

Add features for c_function_prototypes (C90), c_restrict (C99),
c_variadic_macros (C99) and c_static_assert (C11). This feature
set can be extended later.

Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader
to conditionally represent the c_restrict feature.
This commit is contained in:
Stephen Kelly
2014-05-15 00:15:18 +02:00
parent 775458dede
commit e0890d03a4
57 changed files with 630 additions and 27 deletions
@@ -6,6 +6,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(WriteCompilerDetectionHeader)
get_property(cxx_known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
get_property(c_known_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h"
@@ -15,10 +16,10 @@ write_compiler_detection_header(
PROLOG "// something"
EPILOG "// more"
FEATURES
${cxx_known_features}
${cxx_known_features} ${c_known_features}
)
if (NOT CMAKE_CXX_COMPILE_FEATURES)
if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
"int main(int,char**) { return 0; }\n"
)