CMakeLists.txt (683B)
1 cmake_minimum_required(VERSION 3.14) 2 3 project(poaflocExamples CXX) 4 5 include(../cmake/project-is-top-level.cmake) 6 include(../cmake/folders.cmake) 7 8 if(PROJECT_IS_TOP_LEVEL) 9 find_package(poafloc REQUIRED) 10 endif() 11 12 add_custom_target(run-examples) 13 14 function(add_example NAME EXT) 15 add_executable("${NAME}" "${NAME}.${EXT}") 16 target_link_libraries("${NAME}" PRIVATE poafloc::poafloc) 17 target_compile_features("${NAME}" PRIVATE cxx_std_20) 18 add_custom_target("run_${NAME}" COMMAND "${NAME}" VERBATIM) 19 add_dependencies("run_${NAME}" "${NAME}") 20 add_dependencies(run-examples "run_${NAME}") 21 endfunction() 22 23 add_example(example_c c) 24 add_example(example_cpp cpp) 25 26 add_folders(Example)