国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Key Concepts (Mastering CMake)

2019-11-11 01:24:37
字體:
來源:轉載
供稿:網友

1 Key Concepts (Mastering CMake)

1.1 Main Structures

KeyWord

targets, generators and commands, etc.

Source files -> Targets [EXE|LIB]

Directory, Local Generator, Global Generator

Main Structure

1) cmake

controls the cmake PRocesscan be created and used in various GUIs

2) cmake has one cmGlobalGenerator

abstract base classchild classes responsible for platform-specific build process

3) cmGlobalGenerator has many cmLocalGenerator

abstract base classchild classes responsible for platform-specific build file generation

4) cmLocalGenerator has one cmMakefile

Parse CMakeLists.txt and store information from CMakeLists.txt file

List of targets and variablesOptional flagsList of libariesList of include pathes

5) cmCommand

abstract base classchild classes responsible for implementing all commands in CMake

1.2 Targets

add_library, add_executable and add_custom_target

EX#1

add_library (foo STATIC foo1.c foo2.c)

EX#2

add_library (foo foo.cxx)target_link_libraries (foo bar)add_executable (foobar foobar.cxx)target_link_libraries (foobar foo)

1.3 Source Files [TODO]

1.4 Directories, Generators, Tests, and Properties [TODO]

1.5 Variables and Cache Entries [TODO]

EX#1 Control Flow

set (FOO 1)if (${FOO} LESS 2) set (FOO 2)else (${FOO} LESS 2) set (FOO 3)endif (${FOO} LESS 2)

EX#2 Var Scope

function (foo) message (${test}) # test is 1 here set (test 2) message (${test})endfunction()set (test 1)foo()message (${test})

EX#3 Parent Scrope

function (foo) message (${test}) set (test 2 PARENT_SCOPE) message (${test)}endfunction()set (test 1)foo()message (${test}) # test will now be 2 here

EX#4 List

set (items_to_buy apple orange pear bear)foreach (item ${items_to_buy}) message ("Don't forget to buy one ${item}")endforeach()

EX#5 Option

option (USE_JPEG "Do you want to use the JPEG library")

or

set (USE_JPEG ON CACHE BOOL "include jpge support?")

TYPES: BOOL, PATH, FILEPATH, STRING

1.6 CheatSheet

1.6.1 Useful command:

include_directoriesadd_subdirectoryadd_libraryadd_executabletarget_link_librariesfind_package

1.6.1.1 Generate && Build

Case#1 Visual Studio Win64

>> cd build>> cmake -G "Visual Studio 14 2015 Win64" ..>> cmake --build .

Case#2 Visual Studio Win32

>> cd build>> cmake -G "Visual Studio 14 2015" ..>> cmake --build .

Case#3 Build Specific Target

>> cmake --build . --target HelloWorld

1.7 Reference

[1] CMake 3.0.2 Documetation


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 侯马市| 佳木斯市| 上思县| 车致| 株洲市| 新沂市| 泰安市| 建昌县| 莱芜市| 奈曼旗| 新源县| 深水埗区| 呈贡县| 咸宁市| 芜湖县| 神木县| 南丹县| 安化县| 沁源县| 蓬安县| 鱼台县| 娄底市| 鸡西市| 湟源县| 思茅市| 舒城县| 五台县| 张家界市| 昌都县| 曲周县| 溆浦县| 保靖县| 涿州市| 衢州市| 会同县| 宜都市| 静安区| 阳东县| 临沧市| 巴林右旗| 沐川县|