Home | History | Annotate | Download | only in snippets
      1 FILE(GLOB snippets_SRCS "*.cpp")
      2 
      3 ADD_CUSTOM_TARGET(unsupported_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(${PROJECT_SOURCE_DIR}/doc/snippets/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   ADD_CUSTOM_COMMAND(
     18     TARGET ${compile_snippet_target}
     19     POST_BUILD
     20     COMMAND ${compile_snippet_target}
     21     ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
     22   )
     23   ADD_DEPENDENCIES(unsupported_snippets ${compile_snippet_target})
     24   set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
     25                               PROPERTIES OBJECT_DEPENDS ${snippet_src})
     26 ENDFOREACH(snippet_src)
     27