mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 02:01:33 +01:00 
			
		
		
		
	Fix problems while using local packages
update CPM.cmake version too Set FORCE option for SOURCE_DIR usage
This commit is contained in:
		
							parent
							
								
									f0b5bdb1f5
								
							
						
					
					
						commit
						dbce1b7392
					
				
					 3 changed files with 19 additions and 8 deletions
				
			
		|  | @ -1,4 +1,4 @@ | ||||||
| set(CPM_DOWNLOAD_VERSION 0.37.0) | set(CPM_DOWNLOAD_VERSION 0.38.2) | ||||||
| 
 | 
 | ||||||
| if(CPM_SOURCE_CACHE) | if(CPM_SOURCE_CACHE) | ||||||
|   set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") |   set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||||||
|  | @ -27,6 +27,7 @@ else() | ||||||
|   if("${check}" STREQUAL "") |   if("${check}" STREQUAL "") | ||||||
|     download_cpm() |     download_cpm() | ||||||
|   endif() |   endif() | ||||||
|  |   unset(check) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| include(${CPM_DOWNLOAD_LOCATION}) | include(${CPM_DOWNLOAD_LOCATION}) | ||||||
|  |  | ||||||
|  | @ -16,7 +16,11 @@ CPMAddPackage( | ||||||
|   OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES" |   OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) | CPMAddPackage( | ||||||
|  |   NAME Greeter | ||||||
|  |   SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. | ||||||
|  |   FORCE ON | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| # ---- Create standalone executable ---- | # ---- Create standalone executable ---- | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,7 +21,11 @@ CPMAddPackage("gh:TheLartians/Format.cmake@1.7.3") | ||||||
| if(TEST_INSTALLED_VERSION) | if(TEST_INSTALLED_VERSION) | ||||||
|   find_package(Greeter REQUIRED) |   find_package(Greeter REQUIRED) | ||||||
| else() | else() | ||||||
|   CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) |   CPMAddPackage( | ||||||
|  |     NAME Greeter | ||||||
|  |     SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. | ||||||
|  |     FORCE ON | ||||||
|  |   ) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| # ---- Create binary ---- | # ---- Create binary ---- | ||||||
|  | @ -46,11 +50,13 @@ endif() | ||||||
| enable_testing() | enable_testing() | ||||||
| 
 | 
 | ||||||
| # Note: doctest and similar testing frameworks can automatically configure CMake tests. For other | # Note: doctest and similar testing frameworks can automatically configure CMake tests. For other | ||||||
| # testing frameworks add the tests target instead: add_test(NAME ${PROJECT_NAME} COMMAND | # testing frameworks add the tests target instead: | ||||||
| # ${PROJECT_NAME}) | if(NOT doctest_SOURCE_DIR) | ||||||
| 
 |   add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) | ||||||
| include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) | else() | ||||||
| doctest_discover_tests(${PROJECT_NAME}) |   include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) | ||||||
|  |   doctest_discover_tests(${PROJECT_NAME}) | ||||||
|  | endif() | ||||||
| 
 | 
 | ||||||
| # ---- code coverage ---- | # ---- code coverage ---- | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue