Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Ibanez <ibaned@users.noreply.github.com>2020-12-15 00:47:52 +0300
committerGitHub <noreply@github.com>2020-12-15 00:47:52 +0300
commit2d8e17c4f88efce80e274cb03eeb902e055a91d3 (patch)
tree6b4c6077f72722164104316d5a0c25740f2d5c57
parent66b52e6cc9f3f2429dcb01ddb90b6c2f156ac67f (diff)
Add CMake option to not add warning flags (#267)
Allow extra compiler warnings to be disabled.
-rw-r--r--CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index feec2cd..7676638 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,7 @@ enable_testing()
option(CXXOPTS_BUILD_EXAMPLES "Set to ON to build examples" ON)
option(CXXOPTS_BUILD_TESTS "Set to ON to build tests" ON)
option(CXXOPTS_ENABLE_INSTALL "Generate the install target" ON)
+option(CXXOPTS_ENABLE_WARNINGS "Add warnings to CMAKE_CXX_FLAGS" ON)
# request c++11 without gnu extension for the whole project and enable more warnings
if (CXXOPTS_CXX_STANDARD)
@@ -47,11 +48,13 @@ endif()
set(CMAKE_CXX_EXTENSIONS OFF)
+if (CXXOPTS_ENABLE_WARNINGS)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wshadow -Weffc++ -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion -Wsuggest-override")
endif()
+endif()
add_library(cxxopts INTERFACE)
add_library(cxxopts::cxxopts ALIAS cxxopts)