diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 89d3a7e..8d4baa2 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -23,38 +23,38 @@ format: require_valid_layout: false layout_passes: {} markup: - bullet_char: '*' + bullet_char: "*" enum_char: . first_comment_is_literal: false literal_comment_pattern: null fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ - explicit_trailing_pattern: '#<' + explicit_trailing_pattern: "#<" hashruler_min_length: 10 canonicalize_hashrulers: true enable_markup: true lint: disabled_codes: - - C0103 # Invalid argument name - - C0113 # Missing COMMENT in statement which allows it - - C0111 # Missing docstring on function or macro declaration - function_pattern: '[0-9a-z_]+' - macro_pattern: '[0-9A-Z_]+' - global_var_pattern: '[A-Z][0-9A-Z_]+' + - C0103 # Invalid argument name + - C0113 # Missing COMMENT in statement which allows it + - C0111 # Missing docstring on function or macro declaration + function_pattern: "[0-9a-z_]+" + macro_pattern: "[0-9A-Z_]+" + global_var_pattern: "[A-Z][0-9A-Z_]+" internal_var_pattern: _[A-Z][0-9A-Z_]+ - local_var_pattern: '[a-z][a-z0-9_]+' + local_var_pattern: "[a-z][a-z0-9_]+" private_var_pattern: _[0-9a-z_]+ - public_var_pattern: '[A-Z][0-9A-Z_]+' - argument_var_pattern: '[a-z][a-z0-9_]+' - keyword_pattern: '[A-Z][0-9A-Z_]+' + public_var_pattern: "[A-Z][0-9A-Z_]+" + argument_var_pattern: "[a-z][a-z0-9_]+" + keyword_pattern: "[A-Z][0-9A-Z_]+" max_conditionals_custom_parser: 2 min_statement_spacing: 1 max_statement_spacing: 2 max_returns: 6 - max_branches: 40 # Default target: 12 - max_arguments: 6 # Default target: 5 + max_branches: 40 # Default target: 12 + max_arguments: 6 # Default target: 5 max_localvars: 15 - max_statements: 120 # Default target: 50 + max_statements: 125 # Default target: 50 encode: emit_byteorder_mark: false input_encoding: utf-8 diff --git a/CompileOptions.cmake b/CompileOptions.cmake index e979884..3de0191 100644 --- a/CompileOptions.cmake +++ b/CompileOptions.cmake @@ -227,15 +227,31 @@ function(swift_set_compile_options) foreach(target ${targets}) if(cxx_enabled) if(x_EXCEPTIONS) - target_compile_options(${target} PRIVATE $<$:-fexceptions>) + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "IAR") + #target_compile_options(${target} PRIVATE $<$:--exceptions>) + else() + target_compile_options(${target} PRIVATE $<$:-fexceptions>) + endif() else() - target_compile_options(${target} PRIVATE $<$:-fno-exceptions>) + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "IAR") + target_compile_options(${target} PRIVATE $<$:--no_exceptions>) + else() + target_compile_options(${target} PRIVATE $<$:-fno-exceptions>) + endif() endif() if(x_RTTI) - target_compile_options(${target} PRIVATE $<$:-frtti>) + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "IAR") + #target_compile_options(${target} PRIVATE $<$:--rtti>) + else() + target_compile_options(${target} PRIVATE $<$:-frtti>) + endif() else() - target_compile_options(${target} PRIVATE $<$:-fno-rtti>) + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "IAR") + target_compile_options(${target} PRIVATE $<$:--no_rtti>) + else() + target_compile_options(${target} PRIVATE $<$:-fno-rtti>) + endif() endif() endif() diff --git a/LanguageStandards.cmake b/LanguageStandards.cmake index 37bb602..2678cb9 100644 --- a/LanguageStandards.cmake +++ b/LanguageStandards.cmake @@ -60,7 +60,20 @@ function(swift_set_language_standards) set(C_EXTENSIONS OFF) endif() - set_target_properties(${x_UNPARSED_ARGUMENTS} + if(${CMAKE_C_COMPILER_ID} STREQUAL "IAR") + set_target_properties(${x_UNPARSED_ARGUMENTS} + PROPERTIES + C_STANDARD_REQUIRED ON + C_EXTENSIONS ${C_EXTENSIONS} + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + ) + target_compile_options(${x_UNPARSED_ARGUMENTS} PRIVATE $<$:--strict>) + if(NOT ${C_EXTENSIONS}) + target_compile_options(${x_UNPARSED_ARGUMENTS} PRIVATE $<$:--strict>) + endif() + else() + set_target_properties(${x_UNPARSED_ARGUMENTS} PROPERTIES C_STANDARD ${x_C} C_STANDARD_REQUIRED ON @@ -68,5 +81,6 @@ function(swift_set_language_standards) CXX_STANDARD ${x_CXX} CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF - ) + ) + endif() endfunction()