You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

  1. file(GLOB snippets_SRCS "*.cpp")
  2. add_custom_target(all_snippets)
  3. foreach(snippet_src ${snippets_SRCS})
  4. get_filename_component(snippet ${snippet_src} NAME_WE)
  5. set(compile_snippet_target compile_${snippet})
  6. set(compile_snippet_src ${compile_snippet_target}.cpp)
  7. file(READ ${snippet_src} snippet_source_code)
  8. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
  9. ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
  10. add_executable(${compile_snippet_target}
  11. ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
  12. if(STORMEIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
  13. target_link_libraries(${compile_snippet_target} ${STORMEIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
  14. endif()
  15. add_custom_command(
  16. TARGET ${compile_snippet_target}
  17. POST_BUILD
  18. COMMAND ${compile_snippet_target}
  19. ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
  20. )
  21. add_dependencies(all_snippets ${compile_snippet_target})
  22. set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
  23. PROPERTIES OBJECT_DEPENDS ${snippet_src})
  24. endforeach(snippet_src)
  25. ei_add_target_property(compile_tut_arithmetic_transpose_aliasing COMPILE_FLAGS -DSTORMEIGEN_NO_DEBUG)