Code: Select all
find_package(DGM 1.5 REQUIRED PATHS "$ENV{DGMDIR}/build/install")
where "$ENV{DGMDIR}/build/install" is the path to the directory, containing the DGMConfig.cmake file. DGMDIR here is the system variable, pointing to the directory with the DGM library.
The find_package(DGM) command will set the DGM_INCLUDE_DIRS and DGM_LIBRARIES variables, which should be used as follows:
Code: Select all
# Properties -> C/C++ -> General -> Additional Include Directories
include_directories(${DGM_INCLUDE_DIRS})
and
Code: Select all
# Properties -> Linker -> Input -> Additional Dependencies
target_link_libraries(your_project ${DGM_LIBRARIES})
The example of a complete CMakeLists.txt file:
Code: Select all
cmake_minimum_required (VERSION 3.1)
project (SOLUTION_NAME)
# OpenCV and DGM packages
find_package(OpenCV 3.4 REQUIRED core features2d highgui imgproc imgcodecs ml PATHS "$ENV{OPENCVDIR}/build")
find_package(DGM 1.6 REQUIRED PATHS "$ENV{DGMDIR}/build/install")
# Turn on the ability to create folders to organize projects (.vcproj)
# It creates "CMakePredefinedTargets" folder by default and adds CMake defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Sets
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif(MSVC)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
# Properties -> C/C++ -> General -> Additional Include Directories
include_directories(${OpenCV_INCLUDE_DIRS} ${DGM_INCLUDE_DIRS})
#definitions
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
add_executable(PROJECT_NAME "source/main.cpp")
# Properties -> Linker -> Input -> Additional Dependencies
target_link_libraries(PROJECT_NAME ${OpenCV_LIBS} ${DGM_LIBRARIES})