Made example cmake use dlib::dlib link name. Also made the installed

cmake config for dlib enable C++11.
This commit is contained in:
Davis King 2017-02-28 04:43:32 -05:00
parent a2277560fb
commit 67db08f5a6
3 changed files with 8 additions and 4 deletions

View File

@ -690,7 +690,7 @@ if (NOT TARGET dlib)
endif()
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION include/dlib
FILES_MATCHING PATTERN "*.h"
FILES_MATCHING PATTERN "*.h" PATTERN "*.cmake"
REGEX "${CMAKE_CURRENT_BINARY_DIR}" EXCLUDE)
@ -734,3 +734,5 @@ if (NOT TARGET dlib)
endif()
endif()
add_library(dlib::dlib ALIAS dlib)

View File

@ -38,3 +38,5 @@ endif()
find_library(dlib_LIBRARIES dlib HINTS ${dlib_INSTALL_PATH}/lib)
set(dlib_LIBRARIES ${dlib_LIBRARIES} "@dlib_needed_libraries@")
set(dlib_LIBS ${dlib_LIBRARIES} "@dlib_needed_libraries@")
include(${dlib_INSTALL_PATH}/include/dlib/cmake_utils/use_cpp_11.cmake)

View File

@ -16,7 +16,7 @@ include(../dlib/cmake)
# 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)
TARGET_LINK_LIBRARIES(assignment_learning_ex dlib::dlib)
@ -26,7 +26,7 @@ TARGET_LINK_LIBRARIES(assignment_learning_ex dlib)
# your cmake projects and use the syntax shown above.
MACRO(add_example name)
ADD_EXECUTABLE(${name} ${name}.cpp)
TARGET_LINK_LIBRARIES(${name} dlib )
TARGET_LINK_LIBRARIES(${name} dlib::dlib )
ENDMACRO()
# if an example requires GUI, call this macro to check DLIB_NO_GUI_SUPPORT to include or exclude
@ -154,7 +154,7 @@ else()
include_directories(${OpenCV_INCLUDE_DIRS})
ADD_EXECUTABLE(webcam_face_pose_ex webcam_face_pose_ex.cpp)
TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib ${OpenCV_LIBS} )
TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib::dlib ${OpenCV_LIBS} )
else()
message("OpenCV not found, so we won't build the webcam_face_pose_ex example.")
endif()