mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 02:01:33 +01:00 
			
		
		
		
	Replace old code coverage with code-coverage.cmake
				
					
				
			TODO: * Figure out how to exclude dependencies from code coverage reports * Modify GitHub Actions workflows Aims to fix #124
This commit is contained in:
		
							parent
							
								
									acab9a3b78
								
							
						
					
					
						commit
						3ce7e5ccd3
					
				
					 2 changed files with 8 additions and 6 deletions
				
			
		|  | @ -10,8 +10,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake) | ||||||
| 
 | 
 | ||||||
| # enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address, | # enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address, | ||||||
| # Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined' | # Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined' | ||||||
| if(USE_SANITIZER OR USE_STATIC_ANALYZER) | if(USE_SANITIZER OR USE_STATIC_ANALYZER OR CODE_COVERAGE) | ||||||
|   CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354") |   CPMAddPackage("gh:StableCoder/cmake-scripts#1d4bcb41000e7a6a0e6ee1350d91f84f03c14320") | ||||||
|  | 
 | ||||||
|  |   include(${cmake-scripts_SOURCE_DIR}/code-coverage.cmake) | ||||||
| 
 | 
 | ||||||
|   if(USE_SANITIZER) |   if(USE_SANITIZER) | ||||||
|     include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake) |     include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake) | ||||||
|  |  | ||||||
|  | @ -7,6 +7,8 @@ project(GreeterTests LANGUAGES CXX) | ||||||
| option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) | option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) | ||||||
| option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) | option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) | ||||||
| 
 | 
 | ||||||
|  | set(CODE_COVERAGE ${ENABLE_TEST_COVERAGE}) | ||||||
|  | 
 | ||||||
| # --- Import tools ---- | # --- Import tools ---- | ||||||
| 
 | 
 | ||||||
| include(../cmake/tools.cmake) | include(../cmake/tools.cmake) | ||||||
|  | @ -53,7 +55,5 @@ doctest_discover_tests(GreeterTests) | ||||||
| 
 | 
 | ||||||
| # ---- code coverage ---- | # ---- code coverage ---- | ||||||
| 
 | 
 | ||||||
| if(ENABLE_TEST_COVERAGE) | target_code_coverage(Greeter) | ||||||
|   target_compile_options(Greeter PUBLIC -O0 -g -fprofile-arcs -ftest-coverage) | target_code_coverage(GreeterTests AUTO)  | ||||||
|   target_link_options(Greeter PUBLIC -fprofile-arcs -ftest-coverage) |  | ||||||
| endif() |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue