Common cmake
The tutorials in this documentation were built on Linux and Window with this CMakeLists.txt file:
(assuming a sub directory named tutorials with a target per cpp file)
1 cmake_minimum_required(VERSION 3.0.2)
3 project (canvascv-tutorials)
5 find_package(OpenCV 3.1.0 REQUIRED)
7 set(CMAKE_CXX_STANDARD_REQUIRED ON)
8 set(CMAKE_CXX_STANDARD 11)
10 # add include directories to the project
12 ${PROJECT_SOURCE_DIR}/tutorials
13 ${OpenCV_INCLUDE_DIRS}
16 file(GLOB_RECURSE TUTORIAL_SRCS
21 find_library(CanvasCV_LIB canvascv "C:/Program Files/canvascv 1.0.0/lib")
22 include_directories("C:/Program Files/canvascv 1.0.0/include")
24 find_library(CanvasCV_LIB canvascv "/usr/local/lib")
25 include_directories(/usr/local/include)
28 message ("Building these tutorials:")
29 foreach ( file ${TUTORIAL_SRCS} )
30 get_filename_component( target_name ${file} NAME_WE )
31 message ( "Example '${target_name}' will be created")
32 add_executable(${target_name} ${file})
33 target_link_libraries (${target_name} ${CanvasCV_LIB} ${OpenCV_LIBS})
Linux command line
cd projectDir
mkdir build
cd build
cmake ..
make
ls
Windows command line
This should be done from a Developer Command Prompt for VS2015 (Open it from the Start menu):
cd projectDir
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
Now depending if you're linking with a Debug or Release version (usually Release):
msbuild ALL_BUILD.vcxproj /p:Configuration=Release
dir Release\*.exe
OR
msbuild ALL_BUILD.vcxproj /p:Configuration=Debug
dir Debug\*.exe