使用Cmake完成visual studio 2015的Opencv3.0.0及Dlib19.7的部屬配置_part2



Tools 列表
====================================================================
本次學習使用:
(1) Visual studio 2015
(2)Cmake  (opem source)
(3)Opencv3.2.0  (opem source)
https://opencv.org/releases.html
(4)Dlib19.7  (opem source)
====================================================================
這次我們改採用
方式使用Cmake   configuration  配置生成的文檔案編輯法

Basic CMake configuration & Creating a library

於下部分我們會來探討以下兩點配置我們的
開發環境

(1)CmakeLists.txt File
(2)Using Add Library Function



Cmake is the most portable way to configure multiple platforms C++ projects
It uses configuration file which is called Cmakelist.txt


Cmakelist.txt  is the place which is filled with compilation and dependency processes are defined.


你可以於任何目錄下建置你的創意專案

我們先來嘗試學習有關於
CMake文檔中相關的函數操作定義







 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
cmake_minimum_required(VERSION 2.6)

project(CMakeTest)

add_executable(${PROJECT_NAME} main.cpp)

#Create our hello library
add_library(Hello hello.cpp hello.h)

#Create our application that uses our new library
add_executable(executable main.cpp)

#Link our executable with the new library
target_link_libraries(executable Hello)

一開始的 Cmake_minimum_required(VERSION 2.6)
這句不可遺漏  主要定義最低要求版本

再來是
project(project名稱)

add_executable(${PROJECT_NAME} main.cpp)


==>  dollar sign 表示式  主要會去讓任何定義於環境的variable去做存取處裡。



Factorizing shared code among multiple applications is a common practice


It is very useful in big applications or when the common code is shared in multiple applications.
















留言

這個網誌中的熱門文章

何謂淨重(Net Weight)、皮重(Tare Weight)與毛重(Gross Weight)

Architecture(架構) 和 Framework(框架) 有何不同?_軟體設計前的事前規劃的藍圖概念

經得起原始碼資安弱點掃描的程式設計習慣培養(五)_Missing HSTS Header