mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 02:01:33 +01:00 
			
		
		
		
	only apply tools for top-level directory
This commit is contained in:
		
							parent
							
								
									373d3c1651
								
							
						
					
					
						commit
						c74c3a13b1
					
				
					 4 changed files with 16 additions and 14 deletions
				
			
		|  | @ -14,10 +14,6 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) | ||||||
|     message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.") |     message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.") | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| # --- Import tools ---- |  | ||||||
| 
 |  | ||||||
| include(cmake/tools.cmake) |  | ||||||
| 
 |  | ||||||
| # ---- Add dependencies via CPM ---- | # ---- Add dependencies via CPM ---- | ||||||
| # see https://github.com/TheLartians/CPM.cmake for more info | # see https://github.com/TheLartians/CPM.cmake for more info | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,16 +1,16 @@ | ||||||
| # this file contains a list of tools that can be activated and downloaded on-demand | # this file contains a list of tools that can be activated and downloaded on-demand | ||||||
| # each tool is enabled during configuration by passing an additional `-DUSE_<TOOL>=<VALUE>` argument to CMake | # each tool is enabled during configuration by passing an additional `-DUSE_<TOOL>=<VALUE>` argument to CMake | ||||||
| 
 | 
 | ||||||
| # determine if a tool has already been enabled | # only activate tools for top level project | ||||||
| foreach(TOOL USE_SANITIZER;USE_CCACHE) | if (NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||||||
|   get_property(${TOOL}_ENABLED GLOBAL "" PROPERTY ${TOOL}_ENABLED SET)    |   return() | ||||||
| endforeach() | endif() | ||||||
|  | 
 | ||||||
|  | include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake) | ||||||
| 
 | 
 | ||||||
| # enables sanitizers support using the the `USE_SANITIZER` flag | # enables sanitizers support using the the `USE_SANITIZER` flag | ||||||
| # available values are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined' | # available values are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined' | ||||||
| if (USE_SANITIZER AND NOT USE_SANITIZER_ENABLED) | if (USE_SANITIZER) | ||||||
|   set_property(GLOBAL PROPERTY USE_SANITIZER_ENABLED true)  |  | ||||||
| 
 |  | ||||||
|   CPMAddPackage( |   CPMAddPackage( | ||||||
|     NAME StableCoder-cmake-scripts |     NAME StableCoder-cmake-scripts | ||||||
|     GITHUB_REPOSITORY StableCoder/cmake-scripts |     GITHUB_REPOSITORY StableCoder/cmake-scripts | ||||||
|  | @ -22,9 +22,7 @@ endif() | ||||||
| 
 | 
 | ||||||
| # enables CCACHE support through the USE_CCACHE flag | # enables CCACHE support through the USE_CCACHE flag | ||||||
| # possible values are: YES, NO or equivalent | # possible values are: YES, NO or equivalent | ||||||
| if (USE_CCACHE AND NOT USE_CCACHE_ENABLED) | if (USE_CCACHE) | ||||||
|   set_property(GLOBAL PROPERTY USE_CCACHE_ENABLED true)  |  | ||||||
| 
 |  | ||||||
|   CPMAddPackage( |   CPMAddPackage( | ||||||
|     NAME Ccache.cmake |     NAME Ccache.cmake | ||||||
|     GITHUB_REPOSITORY TheLartians/Ccache.cmake |     GITHUB_REPOSITORY TheLartians/Ccache.cmake | ||||||
|  |  | ||||||
|  | @ -4,6 +4,10 @@ project(GreeterStandalone | ||||||
|   LANGUAGES CXX |   LANGUAGES CXX | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | # --- Import tools ---- | ||||||
|  | 
 | ||||||
|  | include(../cmake/tools.cmake) | ||||||
|  | 
 | ||||||
| # ---- Dependencies ---- | # ---- Dependencies ---- | ||||||
| 
 | 
 | ||||||
| include(../cmake/CPM.cmake) | include(../cmake/CPM.cmake) | ||||||
|  |  | ||||||
|  | @ -9,6 +9,10 @@ project(GreeterTests | ||||||
| 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) | ||||||
| 
 | 
 | ||||||
|  | # --- Import tools ---- | ||||||
|  | 
 | ||||||
|  | include(../cmake/tools.cmake) | ||||||
|  | 
 | ||||||
| # ---- Dependencies ---- | # ---- Dependencies ---- | ||||||
| 
 | 
 | ||||||
| include(../cmake/CPM.cmake) | include(../cmake/CPM.cmake) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue