diff --git a/CMakeLists.txt b/CMakeLists.txt index 032d82d6..23ac57d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,27 +351,23 @@ if (NANA_CMAKE_BUILD_DEMOS) endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) # Pending: FreeMe (added but really completely compiled if defined BUILD_FreeMe ) - set (tests) - foreach (demo ${demos}) - set(tests ${tests} ${demos_dir}${demo}) - endforeach( demo ${demos}) - foreach (example ${examples}) - set(tests ${tests} ${examples_dir}${example}) - endforeach(example ${examples}) + function(set_nana_test dir files) + foreach ( test ${files}) + add_executable(${test} "${dir}${test}.cpp") + set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) + target_link_libraries(${test} ${PROJECT_NAME}) + #if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + #add_custom_command( TARGET ${test} POST_BUILD COMMAND ${test} ) + #add_custom_target(do_always_${test} ALL COMMAND ${test}) + #add_test(${test} COMMAND ${test}) + #endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + install(TARGETS ${test} RUNTIME DESTINATION "../nana-demo/") + message("... to build: ${dir}${test}.cpp" ) + endforeach( test ${files}) + function(set_nana_test) - - foreach ( test ${tests}) - add_executable(${test} "${test}.cpp") - set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) - target_link_libraries(${test} ${PROJECT_NAME}) - #if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - #add_custom_command( TARGET ${test} POST_BUILD COMMAND ${test} ) - #add_custom_target(do_always_${test} ALL COMMAND ${test}) - #add_test(${test} COMMAND ${test}) - #endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - install(TARGETS ${test} RUNTIME DESTINATION "../nana-demo/") - message("... to build: ${test}.cpp" ) - endforeach( test ${tests}) + set_nana_test(demos_dir demos) + set_nana_test(examples_dir examples) endif (NANA_CMAKE_BUILD_DEMOS)