mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 10:11:34 +01:00 
			
		
		
		
	add and use WarningsAsErrors cmake module
export cxx_std_20 with target_compile_features() but do not export pedantic Waning options!
This commit is contained in:
		
							parent
							
								
									c2751d904b
								
							
						
					
					
						commit
						c6c34b02d1
					
				
					 3 changed files with 20 additions and 12 deletions
				
			
		|  | @ -33,17 +33,10 @@ endif() | |||
| file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) | ||||
| add_executable(${PROJECT_NAME} ${sources}) | ||||
| target_link_libraries(${PROJECT_NAME} doctest::doctest Greeter::Greeter) | ||||
| set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) | ||||
| target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) | ||||
| 
 | ||||
| # enable compiler warnings | ||||
| if(NOT TEST_INSTALLED_VERSION) | ||||
|   if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||||
|     target_compile_options(Greeter PUBLIC -Wall -Wpedantic -Wextra -Werror) | ||||
|   elseif(MSVC) | ||||
|     target_compile_options(Greeter PUBLIC /W4 /WX) | ||||
|     target_compile_definitions(${PROJECT_NAME} PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS) | ||||
|   endif() | ||||
| endif() | ||||
| include(../cmake/WarningsAsErrors.cmake) | ||||
| 
 | ||||
| # ---- Add GreeterTests ---- | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue