forked from BVLC/caffe
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
32 lines (24 loc) · 1.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
file(GLOB_RECURSE examples_srcs "${PROJECT_SOURCE_DIR}/examples/*.cpp")
foreach(source_file ${examples_srcs})
# get file name
get_filename_component(name ${source_file} NAME_WE)
# get folder name
get_filename_component(path ${source_file} PATH)
get_filename_component(folder ${path} NAME_WE)
add_executable(${name} ${source_file})
target_link_libraries(${name} ${Caffe_LINK})
caffe_default_properties(${name})
# set back RUNTIME_OUTPUT_DIRECTORY
set_target_properties(${name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/examples/${folder}")
caffe_set_solution_folder(${name} examples)
# install
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_BINDIR})
if(UNIX OR APPLE)
# Funny command to make tutorials work
# TODO: remove in future as soon as naming is standardized everywhere
set(__outname ${PROJECT_BINARY_DIR}/examples/${folder}/${name}${Caffe_POSTFIX})
add_custom_command(TARGET ${name} POST_BUILD
COMMAND ln -sf "${__outname}" "${__outname}.bin")
endif()
endforeach()