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