Skip to content

Commit 303af99

Browse files
nashifjhedberg
authored andcommitted
style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines. Signed-off-by: Anas Nashif <[email protected]>
1 parent f0da1d7 commit 303af99

File tree

182 files changed

+506
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+506
-506
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ if(CONFIG_COMPILER_FREESTANDING)
409409
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:compiler,freestanding>>)
410410
endif()
411411

412-
if (CONFIG_PICOLIBC AND NOT CONFIG_PICOLIBC_IO_FLOAT)
412+
if(CONFIG_PICOLIBC AND NOT CONFIG_PICOLIBC_IO_FLOAT)
413413
# @Intent: Set compiler specific flag to disable printf-related optimizations
414414
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,no_printf_return_value>>)
415415
endif()
@@ -1157,7 +1157,7 @@ endif()
11571157

11581158
get_property(OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT)
11591159

1160-
if (CONFIG_CODE_DATA_RELOCATION)
1160+
if(CONFIG_CODE_DATA_RELOCATION)
11611161
set(CODE_RELOCATION_DEP code_relocation_source_lib)
11621162
endif() # CONFIG_CODE_DATA_RELOCATION
11631163

@@ -2134,7 +2134,7 @@ if(CONFIG_BUILD_OUTPUT_INFO_HEADER)
21342134
)
21352135
endif()
21362136

2137-
if (CONFIG_LLEXT AND CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID)
2137+
if(CONFIG_LLEXT AND CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID)
21382138
#slidgen must be the first post-build command to be executed
21392139
#on the Zephyr ELF to ensure that all other commands, such as
21402140
#binary file generation, are operating on a preparated ELF.
@@ -2200,7 +2200,7 @@ if(signing_script)
22002200
endif()
22012201

22022202
# Generate USB-C VIF policies in XML format
2203-
if (CONFIG_BUILD_OUTPUT_VIF)
2203+
if(CONFIG_BUILD_OUTPUT_VIF)
22042204
include(${CMAKE_CURRENT_LIST_DIR}/cmake/vif.cmake)
22052205
endif()
22062206

@@ -2251,7 +2251,7 @@ if(LOG_DICT_DB_NAME_ARG)
22512251
--build-header ${PROJECT_BINARY_DIR}/include/generated/zephyr/version.h
22522252
)
22532253

2254-
if (NOT CONFIG_LOG_DICTIONARY_DB_TARGET)
2254+
if(NOT CONFIG_LOG_DICTIONARY_DB_TARGET)
22552255
# If not using a separate target for generating logging dictionary
22562256
# database, add the generation to post build command to make sure
22572257
# the database is actually being generated.

arch/arm/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ add_subdirectory_ifdef(CONFIG_ARM_AARCH32_MMU mmu)
2727
add_subdirectory_ifdef(CONFIG_CPU_AARCH32_CORTEX_R cortex_a_r)
2828
add_subdirectory_ifdef(CONFIG_CPU_AARCH32_CORTEX_A cortex_a_r)
2929

30-
if (CONFIG_ARM_ZIMAGE_HEADER)
30+
if(CONFIG_ARM_ZIMAGE_HEADER)
3131
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors zimage_header.ld)
3232
zephyr_linker_sources(ROM_START SORT_KEY 0x1vectors vector_table.ld)
3333
zephyr_linker_sources(ROM_START SORT_KEY 0x2vectors cortex_m/vector_table_pad.ld)

arch/arm/core/cortex_m/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ if(CONFIG_NULL_POINTER_EXCEPTION_DETECTION_DWT)
4949
endif()
5050

5151
if(CONFIG_CORTEX_M_DWT)
52-
if (CONFIG_TIMING_FUNCTIONS)
52+
if(CONFIG_TIMING_FUNCTIONS)
5353
zephyr_library_sources(timing.c)
5454
endif()
5555
endif()
5656

57-
if (CONFIG_SW_VECTOR_RELAY)
58-
if (CONFIG_CPU_CORTEX_M_HAS_VTOR)
57+
if(CONFIG_SW_VECTOR_RELAY)
58+
if(CONFIG_CPU_CORTEX_M_HAS_VTOR)
5959
set(relay_vector_table_sort_key relay_vectors)
6060
else()
6161
# Using 0x0 prefix will result in placing the relay vector table section
@@ -72,14 +72,14 @@ zephyr_linker_sources(
7272
)
7373
endif()
7474

75-
if (CONFIG_SW_VECTOR_RELAY OR CONFIG_SW_VECTOR_RELAY_CLIENT)
75+
if(CONFIG_SW_VECTOR_RELAY OR CONFIG_SW_VECTOR_RELAY_CLIENT)
7676
zephyr_linker_sources(
7777
RAM_SECTIONS
7878
vt_pointer_section.ld
7979
)
8080
endif()
8181

82-
if (CONFIG_CPU_CORTEX_M_HAS_VTOR)
82+
if(CONFIG_CPU_CORTEX_M_HAS_VTOR)
8383
zephyr_linker_sources_ifdef(CONFIG_SRAM_VECTOR_TABLE
8484
RAM_SECTIONS
8585
# Maybe need to be changed in order to be placed at the beginning of RAM

arch/arm/core/mpu/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ if(CONFIG_CPU_CORTEX_M AND NOT CONFIG_CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS)
1111
zephyr_library_sources_ifdef(CONFIG_CPU_HAS_NXP_SYSMPU nxp_mpu_regions.c)
1212
endif()
1313

14-
if (CONFIG_CPU_AARCH32_CORTEX_R)
14+
if(CONFIG_CPU_AARCH32_CORTEX_R)
1515
zephyr_library_include_directories(cortex_a_r)
16-
elseif (CONFIG_CPU_CORTEX_M)
16+
elseif(CONFIG_CPU_CORTEX_M)
1717
zephyr_library_include_directories(cortex_m)
18-
else ()
18+
else()
1919
message(FATAL_ERROR "CPU is not Cortex-A/R/M")
20-
endif ()
20+
endif()

arch/arm64/core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ zephyr_library_sources_ifdef(CONFIG_HAS_ARM_SMCCC smccc-call.S)
4141
zephyr_library_sources_ifdef(CONFIG_AARCH64_IMAGE_HEADER header.S)
4242
zephyr_library_sources_ifdef(CONFIG_SEMIHOST semihost.c)
4343
zephyr_library_sources_ifdef(CONFIG_DEBUG_COREDUMP coredump.c)
44-
if ((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP))
44+
if((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP))
4545
zephyr_library_sources(smp.c)
46-
endif ()
46+
endif()
4747

4848
zephyr_cc_option_ifdef(CONFIG_USERSPACE -mno-outline-atomics)
4949
zephyr_cc_option_ifdef(CONFIG_FRAME_POINTER -mno-omit-leaf-frame-pointer)

arch/common/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ zephyr_linker_sources_ifdef(CONFIG_NOCACHE_MEMORY
8686
nocache.ld
8787
)
8888

89-
if (DEFINED CONFIG_ARCH_SUPPORTS_ROM_OFFSET)
89+
if(DEFINED CONFIG_ARCH_SUPPORTS_ROM_OFFSET)
9090
# Exclamation mark is printable character with lowest number in ASCII table.
9191
# We are sure that this file will be included as a first.
9292
zephyr_linker_sources(ROM_START SORT_KEY ! rom_start_address.ld)
@@ -101,7 +101,7 @@ endif()
101101

102102
# isr_tables is a normal CMake library and not a zephyr_library because it
103103
# should not be --whole-archive'd
104-
if (CONFIG_GEN_ISR_TABLES)
104+
if(CONFIG_GEN_ISR_TABLES)
105105
add_library(isr_tables
106106
isr_tables.c
107107
)

arch/posix/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
if (NOT CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE)
3+
if(NOT CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE)
44
message(FATAL_ERROR "The POSIX architecture only works on Linux. If on Windows or macOS "
55
"consider using a virtual machine to run a Linux guest.")
66
endif()
@@ -43,14 +43,14 @@ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTE
4343
# @Intent: Set necessary compiler & linker options for this specific host architecture & OS
4444
include(${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR}.cmake)
4545
else() # Linux.x86_64
46-
if (CONFIG_64BIT)
46+
if(CONFIG_64BIT)
4747
# some gcc versions fail to build without -fPIC
4848
zephyr_compile_options(-m64 -fPIC)
4949
zephyr_link_libraries(-m64)
5050

5151
target_link_options(native_simulator INTERFACE "-m64")
5252
target_compile_options(native_simulator INTERFACE "-m64")
53-
else ()
53+
else()
5454
zephyr_compile_options(-m32)
5555
zephyr_link_libraries(-m32)
5656

@@ -64,7 +64,7 @@ else() # Linux.x86_64
6464
check_set_compiler_property(APPEND PROPERTY fpsse2 "SHELL:-msse2 -mfpmath=sse")
6565
zephyr_compile_options($<TARGET_PROPERTY:compiler,fpsse2>)
6666
target_compile_options(native_simulator INTERFACE "$<TARGET_PROPERTY:compiler,fpsse2>")
67-
endif ()
67+
endif()
6868
endif()
6969

7070
zephyr_compile_options(
@@ -81,7 +81,7 @@ zephyr_ld_options(
8181
-Wl,--unresolved-symbols=ignore-all
8282
)
8383

84-
if (NOT CONFIG_EXTERNAL_LIBC)
84+
if(NOT CONFIG_EXTERNAL_LIBC)
8585
# Get the *compiler* include path, that is where the *compiler* provided headers are (not the
8686
# default libC ones). This includes basic headers like stdint.h, stddef.h or float.h
8787
# We expect something like
@@ -106,7 +106,7 @@ if (NOT CONFIG_EXTERNAL_LIBC)
106106
)
107107
endif()
108108

109-
if (CONFIG_COMPILER_WARNINGS_AS_ERRORS)
109+
if(CONFIG_COMPILER_WARNINGS_AS_ERRORS)
110110
target_compile_options(native_simulator INTERFACE $<TARGET_PROPERTY:compiler,warnings_as_errors>)
111111
endif()
112112

@@ -126,7 +126,7 @@ if(CONFIG_COVERAGE)
126126
target_link_options(native_simulator INTERFACE $<TARGET_PROPERTY:linker,coverage>)
127127
endif()
128128

129-
if (CONFIG_GPROF)
129+
if(CONFIG_GPROF)
130130
zephyr_compile_options($<TARGET_PROPERTY:compiler,gprof>)
131131
zephyr_link_libraries($<TARGET_PROPERTY:linker,gprof>)
132132

arch/posix/Linux.aarch64.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ execute_process(
1414
OUTPUT_STRIP_TRAILING_WHITESPACE
1515
)
1616

17-
if (CONFIG_64BIT)
18-
if (${WORDSIZE} STREQUAL "32")
17+
if(CONFIG_64BIT)
18+
if(${WORDSIZE} STREQUAL "32")
1919
message(FATAL_ERROR
2020
"CONFIG_64BIT=y but this Aarch64 machine has a 32-bit userspace.\n"
2121
"If you were targeting native_sim/native/64, target native_sim instead.\n"
2222
"Otherwise, be sure to define CONFIG_64BIT appropriately.\n"
2323
)
2424
endif()
2525
zephyr_compile_options(-fPIC)
26-
else ()
27-
if (${WORDSIZE} STREQUAL "64")
26+
else()
27+
if(${WORDSIZE} STREQUAL "64")
2828
message(FATAL_ERROR
2929
"CONFIG_64BIT=n but this Aarch64 machine has a 64-bit userspace.\n"
3030
"If you were targeting native_sim, target native_sim/native/64 instead.\n"
3131
"Otherwise, be sure to define CONFIG_64BIT appropriately.\n"
3232
)
3333
endif()
34-
endif ()
34+
endif()

arch/riscv/core/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ zephyr_library_sources(
1313
thread.c
1414
)
1515

16-
if ((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP))
16+
if((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP))
1717
zephyr_library_sources(smp.c)
18-
endif ()
18+
endif()
1919

20-
if (CONFIG_SMP)
20+
if(CONFIG_SMP)
2121
zephyr_library_sources(ipi.c)
2222

2323
zephyr_library_sources_ifdef(CONFIG_RISCV_SMP_IPI_CLINT ipi_clint.c)

arch/x86/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else()
3232
endif()
3333

3434
# Always set for 64-bit (long mode requires page tables), optional for 32-bit
35-
if (CONFIG_MMU)
35+
if(CONFIG_MMU)
3636
set(GEN_MMU ${ZEPHYR_BASE}/arch/x86/gen_mmu.py)
3737

3838
if(DEFINED X86_EXTRA_GEN_MMU_ARGUMENTS)

0 commit comments

Comments
 (0)