Skip to content

Commit 75cfb4b

Browse files
committed
Cleanup CMake compile options
1 parent e644ac7 commit 75cfb4b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

CMakeLists.txt

+15-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
1919
endif()
2020

2121
set(GLFM_SRC src/glfm_internal.h src/glfm_apple.m)
22-
set(GLFM_COMPILE_OPTIONS "-Wno-auto-import;-Wno-direct-ivar-access")
22+
set(GLFM_COMPILE_OPTIONS -Wno-auto-import -Wno-direct-ivar-access)
2323
else()
2424
message(FATAL_ERROR "CMAKE_SYSTEM_NAME ('${CMAKE_SYSTEM_NAME}') expected to be Darwin, Emscripten, or Android")
2525
endif()
@@ -44,12 +44,17 @@ if (GLFM_USE_CLANG_TIDY)
4444
message(WARNING "GLFM_USE_CLANG_TIDY=ON but clang-tidy not found")
4545
else()
4646
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
47-
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE};--config-file=${PROJECT_SOURCE_DIR}/tests/clang-tidy-analyze.yml")
47+
set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE}
48+
--config-file=${PROJECT_SOURCE_DIR}/tests/clang-tidy-analyze.yml)
4849
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
4950
message(WARNING "GLFM_USE_CLANG_TIDY=ON but clang-tidy not functional with Xcode generator")
5051
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
5152
set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 0)
52-
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE};--config-file=${PROJECT_SOURCE_DIR}/tests/clang-tidy-analyze.yml;--extra-arg=--target=wasm32;--extra-arg=-D__EMSCRIPTEN__;--extra-arg=-isystem${EMSCRIPTEN_ROOT_PATH}/cache/sysroot/include")
53+
set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE}
54+
--config-file=${PROJECT_SOURCE_DIR}/tests/clang-tidy-analyze.yml
55+
--extra-arg=--target=wasm32
56+
--extra-arg=-D__EMSCRIPTEN__
57+
--extra-arg=-isystem${EMSCRIPTEN_ROOT_PATH}/cache/sysroot/include)
5358
endif()
5459
endif()
5560
endif()
@@ -63,12 +68,15 @@ source_group(src FILES ${GLFM_SRC})
6368

6469
set_target_properties(glfm PROPERTIES C_STANDARD 11)
6570
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
66-
# Disable the -Wunsafe-buffer-usage warning because it reports false positives when bounds checking arrays, and there appears to be no solution for C pointers.
67-
set_target_properties(glfm PROPERTIES COMPILE_OPTIONS "-Weverything;-Wwrite-strings;-Wno-unknown-warning-option;-Wno-padded;-Wno-covered-switch-default;-Wno-declaration-after-statement;-Wno-unsafe-buffer-usage;${GLFM_COMPILE_OPTIONS}")
71+
# Disable the -Wunsafe-buffer-usage warning because it reports false positives when bounds checking arrays, and
72+
# there appears to be no solution for C pointers.
73+
set_property(TARGET glfm PROPERTY COMPILE_OPTIONS -Weverything -Wwrite-strings -Wno-unknown-warning-option
74+
-Wno-padded -Wno-covered-switch-default -Wno-declaration-after-statement -Wno-unsafe-buffer-usage
75+
${GLFM_COMPILE_OPTIONS})
6876
elseif (CMAKE_C_COMPILER_ID MATCHES "GNU")
69-
set_target_properties(glfm PROPERTIES COMPILE_OPTIONS "-Wall;-Wextra;-Wwrite-strings;${GLFM_COMPILE_OPTIONS}")
77+
set_property(TARGET glfm PROPERTY COMPILE_OPTIONS -Wall -Wextra -Wwrite-strings ${GLFM_COMPILE_OPTIONS})
7078
elseif (CMAKE_C_COMPILER_ID MATCHES "MSVC")
71-
set_target_properties(glfm PROPERTIES COMPILE_OPTIONS "/Wall;${GLFM_COMPILE_OPTIONS}")
79+
set_property(TARGET glfm PROPERTY COMPILE_OPTIONS /Wall ${GLFM_COMPILE_OPTIONS})
7280
endif()
7381

7482
if (CMAKE_SYSTEM_NAME STREQUAL "Android")

0 commit comments

Comments
 (0)