# 设置可执行文件的输出地址 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 INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) set_target_properties(${name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) # 链接动态库 target_link_libraries(${name} PRIVATE ${GCTL_LIB}) target_link_libraries(${name} PRIVATE ${GCTL_GRAPHIC_LIB}) target_link_libraries(${name} PRIVATE gctl_mesh) endif() endmacro() add_example(mesh_ex1 ON) add_example(mesh_ex2 ON) add_example(mesh_ex3 ON) add_example(mesh_ex4 ON) add_example(mesh_ex5 OFF) add_example(mesh_ex6 ON) add_example(mesh_ex7 ON) add_example(mesh_ex8 ON) add_example(mesh_ex9 ON) add_example(mesh_ex10 ON)