CMake: make detection of <stdint.h>, <stdbool.h> and strtof() dependent of BUILD_STRICT_C90

This commit is contained in:
Hugues Delorme 2014-11-19 09:38:24 +01:00
parent 3775dca27c
commit e4dd893ea2

View File

@ -10,22 +10,22 @@ project(gmio C)
# Options
option(BUILD_SHARED_LIBS "Build shared libraries (DLL)" ON)
option(BUILD_STRICT_C90 "Build with strict conformance to C90 standard, if disabled, C99 features can be used (eg. fabsf(), strtof(), ...)" ON)
option(BUILD_STRICT_C90 "Build with strict conformance to C90 standard. If disabled, C99 features can be used (eg. strtof(), <stdint.h>, ...)" ON)
option(BUILD_WITH_LIBSTL "Build the libSTL module" ON)
# Add core source files
file(GLOB ALL_SRC_FILES src/gmio_core/* src/gmio_core/internal/*)
set(ALL_SRC_FILES ${ALL_SRC_FILES})
if(NOT BUILD_STRICT_C90)
# Have <stdint.h> ?
check_include_files(stdint.h GMIO_HAVE_STDINT_H)
# Have strtof() ?
check_function_exists(strtof GMIO_HAVE_STRTOF_FUNC)
# Have <stdbool.h> ?
check_include_files(stdbool.h GMIO_HAVE_STDBOOL_H)
# Have strtof() ?
if(NOT BUILD_STRICT_C90)
check_function_exists(strtof GMIO_HAVE_STRTOF_FUNC)
endif()
# Have builtin byte swap functions ?
@ -124,6 +124,9 @@ add_executable(test_internal EXCLUDE_FROM_ALL tests/stream_buffer.c
src/gmio_core/stream.c
src/gmio_core/internal/ascii_parse.c)
add_executable(test_platform EXCLUDE_FROM_ALL tests/test_platform.c)
add_test(test_internal test_internal)
add_test(test_platform test_platform)
add_dependencies(check test_internal test_platform)
add_dependencies(check test_internal
test_platform)