mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
8c8cab1afd
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case.
27 lines
1.1 KiB
CMake
27 lines
1.1 KiB
CMake
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)
|
|
configure_file(${PROJECT_SOURCE_DIR}/doc/snippets/compile_snippet.cpp.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
|
add_executable(${compile_snippet_target}
|
|
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
|
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
|
endif()
|
|
add_custom_command(
|
|
TARGET ${compile_snippet_target}
|
|
POST_BUILD
|
|
COMMAND ${compile_snippet_target}
|
|
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)
|