1 # Collect source files
2 file(GLOB_RECURSE srcs ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
4 # Build each source file independently
5 foreach(source ${srcs})
6 get_filename_component(name ${source} NAME_WE)
8 # caffe target already exits
9 if(name MATCHES "caffe")
10 set(name ${name}.bin)
11 endif()
13 # target
14 add_executable(${name} ${source})
15 target_link_libraries(${name} ${Caffe_LINK})
16 caffe_default_properties(${name})
18 # set back RUNTIME_OUTPUT_DIRECTORY
19 caffe_set_runtime_directory(${name} "${PROJECT_BINARY_DIR}/tools")
20 caffe_set_solution_folder(${name} tools)
22 # restore output name without suffix
23 if(name MATCHES "caffe.bin")
24 set_target_properties(${name} PROPERTIES OUTPUT_NAME caffe)
25 endif()
27 # Install
28 install(TARGETS ${name} DESTINATION bin)
29 endforeach(source)