8000 cmake: move ENABLE_WARNINGS to a module · libgit2/libgit2@f8a2dda · GitHub
[go: up one dir, main page]

Skip to content

Commit f8a2dda

Browse files
committed
cmake: move ENABLE_WARNINGS to a module
1 parent fc6e38c commit f8a2dda

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ INCLUDE(FindThreads)
3434
INCLUDE(FindStatNsec)
3535
INCLUDE(IdeSplitSources)
3636
INCLUDE(FeatureSummary)
37+
INCLUDE(EnableWarnings)
3738

3839
# Build options
3940
#
@@ -191,21 +192,6 @@ ELSE ()
191192

192193
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
193194

194-
MACRO(ENABLE_WARNINGS flag)
195-
IF(ENABLE_WERROR)
196-
ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
197-
ELSE()
198-
ADD_C_FLAG_IF_SUPPORTED(-W${flag})
199-
ENDIF()
200-
ENDMACRO()
201-
202-
MACRO(DISABLE_WARNINGS flag)
203-
ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
204-
IF(ENABLE_WERROR)
205-
ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
206-
ENDIF()
207-
ENDMACRO()
208-
209195
ENABLE_WARNINGS(all)
210196
ENABLE_WARNINGS(extra)
211197

cmake/Modules/EnableWarnings.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
MACRO(ENABLE_WARNINGS flag)
2+
IF(ENABLE_WERROR)
3+
ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
4+
ELSE()
5+
ADD_C_FLAG_IF_SUPPORTED(-W${flag})
6+
ENDIF()
7+
ENDMACRO()
8+
9+
MACRO(DISABLE_WARNINGS flag)
10+
ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
11+
IF(ENABLE_WERROR)
12+
ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
13+
ENDIF()
14+
ENDMACRO()

0 commit comments

Comments
 (0)
0