xref: /aosp_15_r20/external/eigen/doc/examples/CMakeLists.txt (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Lifile(GLOB examples_SRCS "*.cpp")
2*bf2c3715SXin Li
3*bf2c3715SXin Liforeach(example_src ${examples_SRCS})
4*bf2c3715SXin Li  get_filename_component(example ${example_src} NAME_WE)
5*bf2c3715SXin Li  add_executable(${example} ${example_src})
6*bf2c3715SXin Li  if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
7*bf2c3715SXin Li    target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
8*bf2c3715SXin Li  endif()
9*bf2c3715SXin Li  add_custom_command(
10*bf2c3715SXin Li    TARGET ${example}
11*bf2c3715SXin Li    POST_BUILD
12*bf2c3715SXin Li    COMMAND ${example}
13*bf2c3715SXin Li    ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out
14*bf2c3715SXin Li  )
15*bf2c3715SXin Li  add_dependencies(all_examples ${example})
16*bf2c3715SXin Liendforeach()
17*bf2c3715SXin Li
18*bf2c3715SXin Liif(EIGEN_COMPILER_SUPPORT_CPP11)
19*bf2c3715SXin Liei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11")
20*bf2c3715SXin Liendif()