mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 02:28:11 +08:00 
			
		
		
		
	add FTXUI_DEV_WARNINGS option in CMakeLists (#648)
This option allows to enable warnings as errors, and add more compiler warnings
This commit is contained in:
		
							
								
								
									
										9
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -66,7 +66,8 @@ jobs: | |||||||
|           -DFTXUI_BUILD_EXAMPLES:BOOL=ON |           -DFTXUI_BUILD_EXAMPLES:BOOL=ON | ||||||
|           -DFTXUI_BUILD_TESTS:BOOL=ON |           -DFTXUI_BUILD_TESTS:BOOL=ON | ||||||
|           -DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF |           -DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF | ||||||
|           -DFTXUI_ENABLE_INSTALL:BOOL=ON ; |           -DFTXUI_ENABLE_INSTALL:BOOL=ON | ||||||
|  |           -DFTXUI_DEV_WARNINGS:BOOL=ON ; | ||||||
|  |  | ||||||
|       - name: "Build" |       - name: "Build" | ||||||
|         run: > |         run: > | ||||||
| @@ -160,7 +161,8 @@ jobs: | |||||||
|           -DFTXUI_BUILD_EXAMPLES=OFF |           -DFTXUI_BUILD_EXAMPLES=OFF | ||||||
|           -DFTXUI_BUILD_TESTS=OFF |           -DFTXUI_BUILD_TESTS=OFF | ||||||
|           -DFTXUI_BUILD_TESTS_FUZZER=OFF |           -DFTXUI_BUILD_TESTS_FUZZER=OFF | ||||||
|           -DFTXUI_ENABLE_INSTALL=ON; |           -DFTXUI_ENABLE_INSTALL=ON | ||||||
|  |           -DFTXUI_DEV_WARNINGS=ON ; | ||||||
|           cmake --build . --target package; |           cmake --build . --target package; | ||||||
|       - uses: shogo82148/actions-upload-release-asset@v1 |       - uses: shogo82148/actions-upload-release-asset@v1 | ||||||
|         with: |         with: | ||||||
| @@ -196,7 +198,8 @@ jobs: | |||||||
|           -DFTXUI_BUILD_EXAMPLES=ON |           -DFTXUI_BUILD_EXAMPLES=ON | ||||||
|           -DFTXUI_BUILD_TESTS=OFF |           -DFTXUI_BUILD_TESTS=OFF | ||||||
|           -DFTXUI_BUILD_TESTS_FUZZER=OFF |           -DFTXUI_BUILD_TESTS_FUZZER=OFF | ||||||
|           -DFTXUI_ENABLE_INSTALL=OFF; |           -DFTXUI_ENABLE_INSTALL=OFF | ||||||
|  |           -DFTXUI_DEV_WARNINGS=ON ; | ||||||
|           cmake --build . --target doc; |           cmake --build . --target doc; | ||||||
|           cmake --build . ; |           cmake --build . ; | ||||||
|           rsync -amv |           rsync -amv | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF) | |||||||
| option(FTXUI_ENABLE_INSTALL "Generate the install target" ON) | option(FTXUI_ENABLE_INSTALL "Generate the install target" ON) | ||||||
| option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF) | option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF) | ||||||
| option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF) | option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF) | ||||||
|  | option(FTXUI_DEV_WARNINGS "Enable more compiler warnings and warnings as errors" OFF) | ||||||
|  |  | ||||||
| set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \ | set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \ | ||||||
| terminal used will be one of Microsoft and use a set of reasonnable fallback \ | terminal used will be one of Microsoft and use a set of reasonnable fallback \ | ||||||
|   | |||||||
| @@ -66,8 +66,10 @@ function(ftxui_set_options library) | |||||||
|   # Add as many warning as possible: |   # Add as many warning as possible: | ||||||
|   if (WIN32) |   if (WIN32) | ||||||
|     if (MSVC) |     if (MSVC) | ||||||
|       target_compile_options(${library} PRIVATE "/W3") |       if(FTXUI_DEV_WARNINGS) | ||||||
|       target_compile_options(${library} PRIVATE "/WX") |         target_compile_options(${library} PRIVATE "/W3") | ||||||
|  |         target_compile_options(${library} PRIVATE "/WX") | ||||||
|  |       endif() | ||||||
|       target_compile_options(${library} PRIVATE "/wd4244") |       target_compile_options(${library} PRIVATE "/wd4244") | ||||||
|       target_compile_options(${library} PRIVATE "/wd4267") |       target_compile_options(${library} PRIVATE "/wd4267") | ||||||
|       target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS") |       target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS") | ||||||
| @@ -75,13 +77,21 @@ function(ftxui_set_options library) | |||||||
|     # Force Win32 to UNICODE |     # Force Win32 to UNICODE | ||||||
|     target_compile_definitions(${library} PRIVATE UNICODE _UNICODE) |     target_compile_definitions(${library} PRIVATE UNICODE _UNICODE) | ||||||
|   else() |   else() | ||||||
|     target_compile_options(${library} PRIVATE "-Wall") |     if(FTXUI_DEV_WARNINGS) | ||||||
|     target_compile_options(${library} PRIVATE "-Wextra") |       target_compile_options(${library} PRIVATE "-Wall") | ||||||
|     target_compile_options(${library} PRIVATE "-pedantic") |       target_compile_options(${library} PRIVATE "-Werror") | ||||||
|     target_compile_options(${library} PRIVATE "-Werror") |       target_compile_options(${library} PRIVATE "-Wextra") | ||||||
|     target_compile_options(${library} PRIVATE "-Wmissing-declarations") |    | ||||||
|     target_compile_options(${library} PRIVATE "-Wdeprecated") |       target_compile_options(${library} PRIVATE "-Wcast-align") | ||||||
|     target_compile_options(${library} PRIVATE "-Wshadow") |       target_compile_options(${library} PRIVATE "-Wdeprecated") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wmissing-declarations") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wnon-virtual-dtor") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wnull-dereference") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Woverloaded-virtual") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wpedantic") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wshadow") | ||||||
|  |       target_compile_options(${library} PRIVATE "-Wunused") | ||||||
|  |     endif() | ||||||
|   endif() |   endif() | ||||||
|  |  | ||||||
|   if (FTXUI_MICROSOFT_TERMINAL_FALLBACK) |   if (FTXUI_MICROSOFT_TERMINAL_FALLBACK) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SpaceIm
					SpaceIm