👷 added option to switch off exceptions
This commit is contained in:
		
							parent
							
								
									839681ff9f
								
							
						
					
					
						commit
						268f5a3d0a
					
				
					 2 changed files with 14 additions and 9 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| option(JSON_Sanitizer "Build test suite with Clang sanitizer" OFF) | ||||
| option(JSON_Valgrind "Execute test suite with Valgrind" OFF) | ||||
| option(JSON_NoExceptions "Build test suite without exceptions" OFF) | ||||
| 
 | ||||
| if(JSON_Sanitizer) | ||||
|     message(STATUS "Building test suite with Clang sanitizer") | ||||
|  | @ -16,6 +17,14 @@ if(JSON_Valgrind) | |||
|     separate_arguments(memcheck_command) | ||||
| endif() | ||||
| 
 | ||||
| if(JSON_NoExceptions) | ||||
|     message(STATUS "Building test suite without exceptions") | ||||
|     if(NOT MSVC) | ||||
|         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJSON_NOEXCEPTION") | ||||
|     endif() | ||||
|     set(CATCH_TEST_FILTER -e) | ||||
| endif() | ||||
| 
 | ||||
| ############################################################################# | ||||
| # Catch library with the main function to speed up build | ||||
| ############################################################################# | ||||
|  | @ -62,20 +71,20 @@ foreach(file ${files}) | |||
|     endif() | ||||
| 
 | ||||
|     add_test(NAME "${testcase}_default" | ||||
|       COMMAND ${testcase} | ||||
|       COMMAND ${testcase} ${CATCH_TEST_FILTER} | ||||
|       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||
|     ) | ||||
|     set_tests_properties("${testcase}_default" PROPERTIES LABELS "default") | ||||
| 
 | ||||
|     add_test(NAME "${testcase}_all" | ||||
|       COMMAND ${testcase} "*" | ||||
|       COMMAND ${testcase} ${CATCH_TEST_FILTER} "*" | ||||
|       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||
|     ) | ||||
|     set_tests_properties("${testcase}_all" PROPERTIES LABELS "all") | ||||
| 
 | ||||
|     if(JSON_Valgrind) | ||||
|         add_test(NAME "${testcase}_valgrind" | ||||
|           COMMAND ${memcheck_command} ${CMAKE_CURRENT_BINARY_DIR}/${testcase} | ||||
|           COMMAND ${memcheck_command} ${CMAKE_CURRENT_BINARY_DIR}/${testcase} ${CATCH_TEST_FILTER} | ||||
|           WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||
|         ) | ||||
|         set_tests_properties("${testcase}_valgrind" PROPERTIES LABELS "valgrind") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue