Made example's CMakeLists.txt file a little more tutorial like.

This commit is contained in:
Davis King 2015-01-31 09:43:57 -05:00
parent 6fbd0dacc9
commit 4d223d4d54
1 changed files with 14 additions and 5 deletions

View File

@ -10,10 +10,20 @@ PROJECT(examples)
include(../dlib/cmake)
# We are going to use a macro to add all the example programs. However,
# usually you will only create one executable in your cmake projects.
# Therefore, you would just need to invoke ADD_EXECUTABLE() and
# TARGET_LINK_LIBRARIES() as shown below.
# Tell CMake to compile a program. We do this with the ADD_EXECUTABLE()
# statement which takes the name of the output executable and then a list of
# .cpp files to compile. Here each example consists of only one .cpp file but
# in general you will make programs that const of many .cpp files.
ADD_EXECUTABLE(assignment_learning_ex assignment_learning_ex.cpp)
# Then we tell it to link with dlib.
TARGET_LINK_LIBRARIES(assignment_learning_ex dlib)
# Since there are a lot of examples I'm going to use a macro to simply this
# CMakeLists.txt file. However, usually you will create only one executable in
# your cmake projects and use the syntax shown above.
MACRO(add_example name)
ADD_EXECUTABLE(${name} ${name}.cpp)
TARGET_LINK_LIBRARIES(${name} dlib )
@ -21,7 +31,6 @@ ENDMACRO()
#here we apply our macros
add_example(assignment_learning_ex)
add_example(bayes_net_ex)
add_example(bayes_net_from_disk_ex)
add_example(bayes_net_gui_ex)