summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-02-05 15:21:37 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-02-05 17:17:18 +0000
commitf8a2dda8266e09540b9821e20bf081da2355b105 (patch)
treed8bffd2abc835f0f38b6a8050ef6807ab5b79d1a
parentfc6e38c2fc4fb1f97ad17f45d1a165ef4211936c (diff)
downloadlibgit2-ethomson/cmake_fixes.tar.gz
cmake: move ENABLE_WARNINGS to a moduleethomson/cmake_fixes
-rw-r--r--CMakeLists.txt16
-rw-r--r--cmake/Modules/EnableWarnings.cmake14
2 files changed, 15 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index baadfe217..53f10ba94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,7 @@ INCLUDE(FindThreads)
INCLUDE(FindStatNsec)
INCLUDE(IdeSplitSources)
INCLUDE(FeatureSummary)
+INCLUDE(EnableWarnings)
# Build options
#
@@ -191,21 +192,6 @@ ELSE ()
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
- MACRO(ENABLE_WARNINGS flag)
- IF(ENABLE_WERROR)
- ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
- ELSE()
- ADD_C_FLAG_IF_SUPPORTED(-W${flag})
- ENDIF()
- ENDMACRO()
-
- MACRO(DISABLE_WARNINGS flag)
- ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
- IF(ENABLE_WERROR)
- ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
- ENDIF()
- ENDMACRO()
-
ENABLE_WARNINGS(all)
ENABLE_WARNINGS(extra)
diff --git a/cmake/Modules/EnableWarnings.cmake b/cmake/Modules/EnableWarnings.cmake
new file mode 100644
index 000000000..e7d7d3986
--- /dev/null
+++ b/cmake/Modules/EnableWarnings.cmake
@@ -0,0 +1,14 @@
+MACRO(ENABLE_WARNINGS flag)
+ IF(ENABLE_WERROR)
+ ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
+ ELSE()
+ ADD_C_FLAG_IF_SUPPORTED(-W${flag})
+ ENDIF()
+ENDMACRO()
+
+MACRO(DISABLE_WARNINGS flag)
+ ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
+ IF(ENABLE_WERROR)
+ ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
+ ENDIF()
+ENDMACRO()