
function(remove_generator_macros t m)
	while(1)
		list(FIND CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${m} GEN_MACRO_INDEX)
		if( ${GEN_MACRO_INDEX} GREATER -1 )
			#message("remove ${t} ${m} ${GEN_MACRO_INDEX}")
			list(REMOVE_AT CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${GEN_MACRO_INDEX})
			list(REMOVE_AT CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${GEN_MACRO_INDEX})
			SET(CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS} CACHE INTERNAL "")
		else()
			break()
		endif()				
	endwhile()
endfunction()	

function(add_generator_macros t m v)
	#message("${CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS}")
	list(APPEND CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${m} ${v})
	SET(CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS ${CMAKE_EXTRA_GENERATOR_${t}_SYSTEM_DEFINED_MACROS} CACHE INTERNAL "")
endfunction()	

function(fix_eclipse_generator)
	remove_generator_macros(CXX __cplusplus)
	remove_generator_macros(CXX __clang_version__)
	remove_generator_macros(C __clang_version__)
	remove_generator_macros(CXX __VERSION__)
	remove_generator_macros(C __VERSION__)	
	add_generator_macros(CXX __cplusplus "201703L")
endfunction()