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(mobser_dipole_ex ON) add_example(mobser_block_ex ON) add_example(mobser_block_gradient_ex ON) add_example(mobser_tri_ex ON) add_example(mobser_tri_sph_ex ON) add_example(mobser_tricone_ex ON) add_example(mobser_tetra_ex ON) add_example(mobser_tetra_ex2 ON) add_example(mobser_tetra_sph_ex ON) add_example(mobser_tesseroid_ex ON) add_example(read_IGRF_ex ON)