set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

macro(add_example name switch)
	if(${switch})
		# 添加可执行程序名称
		add_executable(${name} ${name}.cpp)
		# 设置安装后的动态库调用地址
		set_target_properties(${name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
		set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
		target_link_libraries(${name} PUBLIC gctl_potential)
	endif()
endmacro()

add_example(gobser_tri2d_ex ON)
add_example(mobser_dipole_ex OFF)
add_example(mobser_block_ex OFF)
add_example(mobser_block_gradient_ex OFF)
add_example(mobser_tri_ex OFF)
add_example(mobser_tri_sph_ex OFF)
add_example(mobser_tricone_ex OFF)
add_example(mobser_tetra_ex OFF)
add_example(mobser_tetra_ex2 OFF)
add_example(mobser_tetra_sph_ex OFF)
add_example(mobser_tesseroid_ex OFF)
add_example(read_IGRF_ex OFF)
add_example(power_spectrum_ex OFF)