mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 02:01:33 +01:00 
			
		
		
		
	add cmake tools option to easy dynamic setup
This commit is contained in:
		
							parent
							
								
									2cf15bc347
								
							
						
					
					
						commit
						aa02116995
					
				
					 3 changed files with 14 additions and 2 deletions
				
			
		|  | @ -10,6 +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' | ||||||
|  | set(USE_SANITIZER | ||||||
|  |     "Address;Undefined" | ||||||
|  |     CACHE STRING "one or more of: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak" | ||||||
|  | ) | ||||||
| if(USE_SANITIZER OR USE_STATIC_ANALYZER) | if(USE_SANITIZER OR USE_STATIC_ANALYZER) | ||||||
|   CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354") |   CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354") | ||||||
| 
 | 
 | ||||||
|  | @ -17,6 +21,10 @@ if(USE_SANITIZER OR USE_STATIC_ANALYZER) | ||||||
|     include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake) |     include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake) | ||||||
|   endif() |   endif() | ||||||
| 
 | 
 | ||||||
|  |   set(USE_STATIC_ANALYZER | ||||||
|  |       "" | ||||||
|  |       CACHE STRING "one or more of: clang-tidy, iwyu, cppcheck" | ||||||
|  |   ) | ||||||
|   if(USE_STATIC_ANALYZER) |   if(USE_STATIC_ANALYZER) | ||||||
|     if("clang-tidy" IN_LIST USE_STATIC_ANALYZER) |     if("clang-tidy" IN_LIST USE_STATIC_ANALYZER) | ||||||
|       set(CLANG_TIDY |       set(CLANG_TIDY | ||||||
|  | @ -61,6 +69,7 @@ if(USE_SANITIZER OR USE_STATIC_ANALYZER) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| # enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent | # enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent | ||||||
|  | option(USE_CCACHE "enables ccache support" YES) | ||||||
| if(USE_CCACHE) | if(USE_CCACHE) | ||||||
|   CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.3") |   CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.3") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
|  | @ -24,7 +24,10 @@ file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) | ||||||
| 
 | 
 | ||||||
| add_executable(${PROJECT_NAME} ${sources}) | add_executable(${PROJECT_NAME} ${sources}) | ||||||
| 
 | 
 | ||||||
| # TODO(CK): why is this needed? | # enable pedantic compiler warnings | ||||||
|  | include(../cmake/WarningsAsErrors.cmake) | ||||||
|  | 
 | ||||||
|  | # TODO(CK): why is this needed on CI? | ||||||
| set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Greeter) | set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Greeter) | ||||||
| 
 | 
 | ||||||
| target_link_libraries(${PROJECT_NAME} Greeter::Greeter cxxopts) | target_link_libraries(${PROJECT_NAME} Greeter::Greeter cxxopts) | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ add_executable(${PROJECT_NAME} ${sources}) | ||||||
| target_link_libraries(${PROJECT_NAME} doctest::doctest Greeter::Greeter) | target_link_libraries(${PROJECT_NAME} doctest::doctest Greeter::Greeter) | ||||||
| target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) | ||||||
| 
 | 
 | ||||||
| # enable compiler warnings | # enable pedantic compiler warnings | ||||||
| include(../cmake/WarningsAsErrors.cmake) | include(../cmake/WarningsAsErrors.cmake) | ||||||
| 
 | 
 | ||||||
| # ---- Add GreeterTests ---- | # ---- Add GreeterTests ---- | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue