2009-03-19 04:06:06 +08:00
|
|
|
FILE(GLOB snippets_SRCS "*.cpp")
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(unsupported_snippets)
|
|
|
|
|
|
|
|
FOREACH(snippet_src ${snippets_SRCS})
|
|
|
|
GET_FILENAME_COMPONENT(snippet ${snippet_src} NAME_WE)
|
|
|
|
SET(compile_snippet_target compile_${snippet})
|
|
|
|
SET(compile_snippet_src ${compile_snippet_target}.cpp)
|
|
|
|
FILE(READ ${snippet_src} snippet_source_code)
|
2009-12-08 03:10:11 +08:00
|
|
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/snippets/compile_snippet.cpp.in
|
2009-03-19 04:06:06 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
|
|
|
ADD_EXECUTABLE(${compile_snippet_target}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
2010-04-19 23:19:22 +08:00
|
|
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
|
|
|
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
|
|
|
endif()
|
2009-03-19 04:06:06 +08:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
TARGET ${compile_snippet_target}
|
|
|
|
POST_BUILD
|
2014-08-22 18:13:07 +08:00
|
|
|
COMMAND ${compile_snippet_target}
|
2009-03-19 04:06:06 +08:00
|
|
|
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
|
|
|
|
)
|
|
|
|
ADD_DEPENDENCIES(unsupported_snippets ${compile_snippet_target})
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
|
|
|
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
|
|
|
ENDFOREACH(snippet_src)
|