aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorTaylor Holberton <tay10r@protonmail.com>2020-06-30 16:09:38 -0500
committerGitHub <noreply@github.com>2020-06-30 16:09:38 -0500
commit393f0a6e738755ae6e3c3eb88b7a1684d9f0829c (patch)
tree144c12e4d2f0ee9907466b8cbd3c481b671811f4 /CMakeLists.txt
parent8646e47e16cf38415f3b091d391cfdaf5ba8a9c1 (diff)
parent0c279d81e722e8e7c285dae22666675787bd30e9 (diff)
Merge pull request #164 from E5ten/cmake-standard
cmake: specify c99
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1388a8d..acd4807 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@ execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/version.sh -s print
project("TinyALSA" VERSION ${TINYALSA_VERSION} LANGUAGES C)
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+set(CMAKE_C_EXTENSIONS OFF)
+
# Options
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(TINYALSA_USES_PLUGINS "Whether or not to build with plugin support" OFF)
@@ -38,7 +42,8 @@ target_include_directories("tinyalsa" PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_definitions("tinyalsa" PRIVATE
- $<$<BOOL:${TINYALSA_USES_PLUGINS}>:TINYALSA_USES_PLUGINS>)
+ $<$<BOOL:${TINYALSA_USES_PLUGINS}>:TINYALSA_USES_PLUGINS>
+ PUBLIC _POSIX_C_SOURCE=200809L)
target_link_libraries("tinyalsa" PUBLIC ${CMAKE_DL_LIBS})
# Examples
@@ -68,7 +73,7 @@ target_link_libraries("tinywavinfo" PRIVATE m)
# Add C warning flags
include(CheckCCompilerFlag)
-foreach(FLAG IN ITEMS -Wall -Wextra -Werror -Wfatal-errors)
+foreach(FLAG IN ITEMS -Wall -Wextra -Wpedantic -Werror -Wfatal-errors)
string(TOUPPER "HAVE${FLAG}" HAVE_VAR)
string(REPLACE "-" "_" HAVE_VAR "${HAVE_VAR}")
check_c_compiler_flag("${FLAG}" "${HAVE_VAR}")