igl_add_tutorial.cmake 659 B

1234567891011121314151617181920
  1. function(igl_add_tutorial name)
  2. # Only create tutorial if dependencies have been enabled in the current build
  3. foreach(module IN ITEMS ${ARGN})
  4. if(NOT TARGET ${module})
  5. return()
  6. endif()
  7. endforeach()
  8. message(STATUS "Creating libigl tutorial: ${name}")
  9. # get all cpp files in ${CMAKE_CURRENT_SOURCE_DIR}/${name}/
  10. file(GLOB SRCFILES ${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp)
  11. add_executable(${name} ${SRCFILES})
  12. target_link_libraries(${name} PRIVATE
  13. igl::core
  14. igl::tutorial_data
  15. ${ARGN}
  16. )
  17. set_target_properties(${name} PROPERTIES FOLDER Libigl_Tutorials)
  18. endfunction()