ΠΊΠ°ΠΊ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ cmake Π½Π° windows
Π ΡΡΡΠΊΠΈΠ΅ ΠΠ»ΠΎΠ³ΠΈ
Π£ΡΠ΅Π±Π½ΠΈΠΊ ΠΏΠΎ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅ ΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ VSCode CMake
ΠΎΠ±Π·ΠΎΡ
ΠΡΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠΈ cmake Π΄Π»Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌ Π½Π° C / C ++ Π² Windows Π²Π°ΠΌ ΡΠ½Π°ΡΠ°Π»Π° ΠΏΠΎΠ½Π°Π΄ΠΎΠ±ΠΈΡΡΡ CMake, ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΠ΅ ΡΡΠ΅Π΄Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ gcc / g ++, Π·Π°ΡΠ΅ΠΌ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠΉΡΠ΅ VSCode ΠΈ Π½Π°ΡΡΡΠΎΠΉΡΠ΅ CMakelist.txt.
Π§ΡΠΎ ΡΠ°ΠΊΠΎΠ΅ CMake
ΠΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ, Π²Ρ ΡΠ»ΡΡΠ°Π»ΠΈ ΠΎ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΈΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ°Ρ Make, ΡΠ°ΠΊΠΈΡ ΠΊΠ°ΠΊ GNU Make, Qmake QT, MS nmake ΠΎΡ Microsoft, BSD Make (pmake), Makepp ΠΈ ΡΠ°ΠΊ Π΄Π°Π»Π΅Π΅. ΠΡΠΈ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ Make ΡΠ»Π΅Π΄ΡΡΡ ΡΠ°Π·Π»ΠΈΡΠ½ΡΠΌ ΡΠΏΠ΅ΡΠΈΡΠΈΠΊΠ°ΡΠΈΡΠΌ ΠΈ ΡΡΠ°Π½Π΄Π°ΡΡΠ°ΠΌ, ΠΈ ΡΠΎΡΠΌΠ°Ρ ΠΈΡΠΏΠΎΠ»Π½ΡΠ΅ΠΌΠΎΠ³ΠΎ ΠΈΠΌΠΈ ΡΠ°ΠΉΠ»Π° Makefile ΡΠΈΠ»ΡΠ½ΠΎ ΡΠ°Π·Π»ΠΈΡΠ°Π΅ΡΡΡ. ΠΡΠΎ ΡΠΎΠ·Π΄Π°Π΅Ρ ΡΠ΅ΡΡΠ΅Π·Π½ΡΡ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ: Π΅ΡΠ»ΠΈ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ½ΠΎΠ΅ ΠΎΠ±Π΅ΡΠΏΠ΅ΡΠ΅Π½ΠΈΠ΅ Ρ ΠΎΡΠ΅Ρ ΠΊΡΠΎΡΡ-ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ΅Π½Π½ΠΎΠ΅, ΠΎΠ½ΠΎ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π³Π°ΡΠ°Π½ΡΠΈΡΠΎΠ²Π°ΡΡ, ΡΡΠΎ ΠΎΠ½ΠΎ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΡΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡΠΎΠ²Π°Π½ΠΎ Π½Π° ΡΠ°Π·Π½ΡΡ ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ°Ρ . ΠΡΠ»ΠΈ Π²Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΠ΅ Π²ΡΡΠ΅ΡΠΏΠΎΠΌΡΠ½ΡΡΡΠΉ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½Ρ Make, Π²Ρ Π΄ΠΎΠ»ΠΆΠ½Ρ Π½Π°ΠΏΠΈΡΠ°ΡΡ Makefile Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΡΡΠ°Π½Π΄Π°ΡΡΠ°, ΡΡΠΎ Π±ΡΠ΄Π΅Ρ ΡΡΠΌΠ°ΡΡΠ΅Π΄ΡΠ΅ΠΉ ΡΠ°Π±ΠΎΡΠΎΠΉ.
ΠΠ±ΡΡΠ½ΠΎ ΠΏΡΠΎΡΠ΅ΡΡ Π³Π΅Π½Π΅ΡΠ°ΡΠΈΠΈ ΠΈ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ Makefile Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ΠΌ CMake Π²ΡΠ³Π»ΡΠ΄ΠΈΡ ΡΠ»Π΅Π΄ΡΡΡΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ:
Π³ΠΎΡΠΎΠ²
1. VSCode (ΡΠ»Π΅Π΄ΡΡΡΠΈΠ΅ ΠΏΠ»Π°Π³ΠΈΠ½Ρ Π΄ΠΎΠ»ΠΆΠ½Ρ Π±ΡΡΡ ΡΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½Ρ)
C/C++
C++ Intellisense
CMake
CMake tools
CMake Tools Helper
2. MinGW, ΡΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²ΠΎ ΠΏΠΎ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅ [ΠΠΎΡΡΠ°Π»γ
3.CMake
Π£ΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ CMake
ΠΠ°ΡΡΡΠΎΠΉΡΠ΅ CMake Π² VSCode
ΠΠ°ΠΊ ΠΏΡΠ°Π²ΠΈΠ»ΠΎ, ΠΏΠΎΡΠ»Π΅ ΡΠΎΠ³ΠΎ, ΠΊΠ°ΠΊ Π²Ρ ΠΏΡΠΎΡΡΠΎ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΠ΅ ΠΏΠ»Π°Π³ΠΈΠ½ CMake, Π²Π°ΠΌ Π±ΡΠ΄Π΅Ρ Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΎ Π²ΡΠ±ΡΠ°ΡΡ ΡΠ΅ΠΏΠΎΡΠΊΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ² ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ. ΠΡΠ»ΠΈ ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠΈ Π½Π΅Ρ ΠΈΠ»ΠΈ Π²Ρ Ρ
ΠΎΡΠΈΡΠ΅ Π·Π°ΠΌΠ΅Π½ΠΈΡΡ Π΄ΡΡΠ³ΠΈΠ΅ ΡΠ΅ΠΏΠΎΡΠΊΠΈ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ² ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ, Π²Ρ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ctrl + shiftl + p, Π²Π²Π΅ΡΡΠΈ ΡΠ»Π΅Π΄ΡΡΡΠΈΠ΅ ΠΈΠ½ΡΡΡΡΠΊΡΠΈΠΈ, Π° Π·Π°ΡΠ΅ΠΌ Π²ΡΠ±ΡΠ°ΡΡ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½ΡΡ ΡΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½Π½ΡΡ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ Π²ΠΎ Π²ΡΠΏΠ»ΡΠ²Π°ΡΡΠ΅ΠΌ ΠΎΠΊΠ½Π΅. Π¦Π΅ΠΏΠΎΡΠΊΠ° Π΄Π»Ρ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ².
CMake:Select a Kit
ΠΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ CMake
Π’Π΅ΠΏΠ΅ΡΡ ΠΌΡ ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΊΠ°ΡΠ°Π»ΠΎΠ³ ΡΠΎ ΡΠ»Π΅Π΄ΡΡΡΠ΅ΠΉ ΡΡΡΡΠΊΡΡΡΠΎΠΉ:
ΠΠΎΠ΄ main.c Π²ΡΠ³Π»ΡΠ΄ΠΈΡ ΡΠ»Π΅Π΄ΡΡΡΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ:
Π§ΡΠΎΠ±Ρ ΡΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡΠΎΠ²Π°ΡΡ ΡΡΠΎΡ ΡΠ°ΠΉΠ», ΠΌΡ ΡΠ΅Π΄Π°ΠΊΡΠΈΡΡΠ΅ΠΌ ΡΠ°ΠΉΠ» CMakeLists.txt ΡΠ»Π΅Π΄ΡΡΡΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ:
ΠΠ°ΡΠ΅ΠΌ Π²ΠΎΠΉΠ΄ΠΈΡΠ΅ Π² ΠΊΠ°ΡΠ°Π»ΠΎΠ³ Build ΠΈ Π²ΡΠΏΠΎΠ»Π½ΠΈΡΠ΅ cmake
ΠΡΠ²ΠΎΠ΄ Π²ΡΠ³Π»ΡΠ΄ΠΈΡ ΡΠ»Π΅Π΄ΡΡΡΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ, ΠΈ Π² ΠΏΠ°ΠΏΠΊΠ΅ Build ΡΠΎΠ·Π΄Π°Π΅ΡΡΡ ΠΌΠ½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»ΠΎΠ², Π²ΠΊΠ»ΡΡΠ°Ρ ΡΠ°ΠΉΠ» Makefile.
Π€Π°ΠΉΠ»Ρ, ΡΠΎΠ΄Π΅ΡΠΆΠ°ΡΠΈΠ΅ΡΡ Π² ΠΏΠ°ΠΏΠΊΠ΅ Build
ΠΠ° Π΄Π°Π½Π½ΡΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ ΠΌΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΠΌ make ΠΠΎΠΌΠ°Π½Π΄Π°, Π²Ρ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΡΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡΠΎΠ²Π°ΡΡ Π½Π°ΡΡ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ.
ΠΠ°ΠΊΠΎΠ½Π΅Ρ, ΠΏΠΎΠΏΡΠΎΠ±ΡΠΉΡΠ΅, ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ Π½ΠΎΡΠΌΠ°Π»ΡΠ½ΡΠΉ.
ΠΠ½ΡΠ΅Π»Π»Π΅ΠΊΡΡΠ°Π»ΡΠ½Π°Ρ ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°ΡΠΈΡ
AlamoFire Source Severtation Series (12) ΠΎΡΡ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ (Π²ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ ΡΠΊΠ°Π»Π°)
ΠΡΠ° ΡΡΠ°ΡΡΡ ΠΏΡΠΈΠ½ΠΎΡΠΈΡ Π½Π΅ΠΊΠΎΡΠΎΡΡΠ΅ ΠΈΠ΄Π΅ΠΈ ΠΎ Π²ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΠΉ ΡΠΊΠ°Π»Π΅ Π² AlamoFire ΠΡΠ΅ΡΡΡΠΏΠ½ΠΎΡΡΡ ΠΠ΅ΡΠ΅Π²ΠΎΠ΄ Timeline ΠΎΠ·Π½Π°ΡΠ°Π΅Ρ, ΡΡΠΎ Π²ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ ΡΠΊΠ°Π»Π° ΠΌΠΎΠΆΠ΅Ρ ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΡΡ ΡΠΎΠ±ΡΡΠΈΠ΅ Ρ Π½Π°ΡΠ°Π»Π° Π΄ΠΎ ΠΊΠΎΠ½ΡΠ° ΡΠ·Π»Π° Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ. ΠΠΎΠ½ΡΠ΅ΠΏΡΠΈΡ Π²ΡΠ΅ΠΌΠ΅Π½.
ΠΠ½Π°Π»ΠΈΠ· ΡΠ°Π·Π½ΠΈΡΡ ΠΌΠ΅ΠΆΠ΄Ρ iOS initWithFrame, initWithCoder, awakeFromNib
ΠΡΡΠ»Π΅Π΄ΠΎΠ²Π°Π½ΠΈΠ΅ ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΡ ΡΠΈΠΏΠΎΠ²ΡΡ Π²Π΅ΡΡΠΈΠΉ ΡΠ°ΠΌΡ
ΠΠ½Π°ΠΊΠΎΠΌΡΡΠ²ΠΎ Ρ CMake. Π§Π°ΡΡΡ 1. Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ°, CMakeLists.txt, ΡΠ±ΠΎΡΠΊΠ°.
ΠΠ²Π΅Π΄Π΅Π½ΠΈΠ΅.
ΠΠ½ΠΎΠ³ΠΈΠ΅, ΠΊΡΠΎ Π½Π°ΡΠΈΠ½Π°Π» ΡΠΎΠ·Π΄Π°Π²Π°ΡΡ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½ΡΠ΅ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ, ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π»ΡΡ ΠΊΠ°ΠΊΠΎΠΉ-Π»ΠΈΠ±ΠΎ ΡΠΈΡΡΠ΅ΠΌΠΎΠΉ ΡΠ±ΠΎΡΠΊΠΈ. Π ΠΎΠ±ΡΠ΅ΠΌ, ΡΠΈΡΡΠ΅ΠΌΠ° ΡΠ±ΠΎΡΠΊΠΈ β ΡΡΠΎ Π½Π°Π±ΠΎΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ², ΠΎΠ±Π»Π΅Π³ΡΠ°ΡΡΠΈΠΉ ΡΠ°Π±ΠΎΡΡ Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡΠΎΠΌ. ΠΡΠΎ Π²ΠΊΠ»ΡΡΠ°Π΅Ρ Π² ΡΠ΅Π±Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ, Π»ΠΈΠ½ΠΊΠΎΠ²ΠΊΡ, ΡΡΡΠ°Π½ΠΎΠ²ΠΊΡ, Π° ΡΠ°ΠΊΠΆΠ΅ ΡΠ±ΠΎΡ ΠΈΡΡ ΠΎΠ΄Π½ΡΡ ΡΠ°ΠΉΠ»ΠΎΠ² Π΄Π»Ρ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΠΈ ΠΈΡ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡΡ ΠΈ ΡΠ»Π΅ΠΆΠ΅Π½ΠΈΠ΅ Π·Π° Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡΡΠΌΠΈ. Π’Π°ΠΊΠΆΠ΅ ΡΠΎΠ²ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ ΡΠΈΡΡΠ΅ΠΌΡ ΡΠ±ΠΎΡΠΊΠΈ ΠΎΠ±Π»Π΅Π³ΡΠ°ΡΡ ΡΠ°Π±ΠΎΡΡ Ρ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ, ΠΏΠΎΠ·Π²ΠΎΠ»ΡΡΡ ΡΠΎΠ·Π΄Π°Π²Π°ΡΡ ΠΏΠ΅ΡΠ΅Π½ΠΎΡΠΈΠΌΡΠ΅ ΠΏΡΠΎΠ΅ΠΊΡΡ ΠΈ Π²ΡΠΏΠΎΠ»Π½ΡΡΡ Π΅ΡΡ ΠΌΠ°ΡΡΡ Π΄ΡΡΠ³ΠΈΡ Π²ΠΊΡΡΠ½ΠΎΡΡΠ΅ΠΉ. ΠΡΠ° ΡΡΠ°ΡΡΡ ΠΏΠΎΡΠ²ΡΡΠ΅Π½Π° ΠΏΠΎΠΏΡΠ»ΡΡΠ½ΠΎΠΉ ΡΠΈΡΡΠ΅ΠΌΠ΅ ΡΠ±ΠΎΡΠΊΠΈ CMake ΠΈ ΡΠ°ΡΡΠΊΠ°ΠΆΠ΅Ρ, ΠΊΠ°ΠΊ ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎ Π΅Ρ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ ΠΈ Π½Π°ΡΡΡΠΎΠΈΡΡ, Π° ΡΠ°ΠΊΠΆΠ΅ Π±ΡΠ΄Π΅Ρ ΡΠ°ΡΡΠΌΠΎΡΡΠ΅Π½ ΠΏΡΠΎΡΡΠΎΠΉ ΠΏΡΠΈΠΌΠ΅Ρ Π΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ. ΠΠ½Π° ΡΠ°ΡΡΡΠΈΡΠ°Π½Π° Π½Π° ΡΠ΅Ρ , ΡΡΠΎ Ρ ΠΎΡΡ Π½Π΅ΠΌΠ½ΠΎΠ³ΠΎ Π·Π½Π°ΠΊΠΎΠΌ Ρ ΠΏΠΎΠ½ΡΡΠΈΡΠΌΠΈ make, Makefile, ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ, Π»ΠΈΠ½ΠΊΠΎΠ²ΠΊΠ°.
Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π² Linux.
ΠΠ»Ρ ΠΏΠΎΠΏΡΠ»ΡΡΠ½ΡΡ Π΄ΠΈΡΡΡΠΈΠ±ΡΡΠΈΠ²ΠΎΠ² Linux ΡΠΈΠΏΠ° Debian, Gentoo, Fedora ΠΈ Ρ.Π΄. CMake Π΄Π°Π²Π½ΠΎ Π»Π΅ΠΆΠΈΡ Π² ΠΎΡΠΈΡΠΈΠ°Π»ΡΠ½ΡΡ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΡΡ . ΠΠ°ΠΌ Π½ΡΠΆΠ½ΠΎ Π²ΡΠ΅Π³ΠΎ Π»ΠΈΡΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ ΠΏΠ°ΠΊΠ΅Ρ cmake Ρ ΠΏΠΎΠΌΠΎΡΡΡ ΠΌΠ΅Π½Π΅Π΄ΠΆΠ΅ΡΠ° ΠΏΠ°ΠΊΠ΅ΡΠΎΠ². ΠΠ°ΠΊ ΠΏΡΠ°Π²ΠΈΠ»ΠΎ, ΠΎΠ½ ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅ΡΡΡ Π² ΡΠΈΡΡΠ΅ΠΌΠ½ΡΠ΅ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ, ΠΈ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎΡΡΠΈ ΠΏΡΠ°Π²ΠΈΡΡ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΡ Π½Π΅ΡΡ. ΠΠΎΠΆΠ΅ΡΠ΅ ΠΏΡΠΎΠ²Π΅ΡΠΈΡΡ Π΅Ρ ΡΠ°Π±ΠΎΡΠΎΡΠΏΠΎΡΠΎΠ±Π½ΠΎΡΡΡ, Π²ΡΠΏΠΎΠ»Π½ΠΈΠ²
ΠΡΠ»ΠΈ ΠΆΠ΅ Π² ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΈ Π½Π΅Ρ ΡΠ°ΠΊΠΎΠ³ΠΎ ΠΏΠ°ΠΊΠ΅ΡΠ°, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π΅Π³ΠΎ ΡΠΎΠ±ΡΠ°ΡΡ Π²ΡΡΡΠ½ΡΡ. Π‘ΠΊΠ°ΡΠΈΠ²Π°Π΅ΠΌ Unix/Linux Source, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, cmake-3.5.0-rc3.tar.gz, ΡΠ°ΡΠΏΠ°ΠΊΠΎΠ²ΡΠ²Π°Π΅ΠΌ ΠΈ ΡΠΎΠ±ΠΈΡΠ°Π΅ΠΌ:
Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π² Windows.
ΠΠ»Ρ Windows Π½Π° ΡΠ°ΠΉΡΠ΅ CMake Π»Π΅ΠΆΠΈΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΎΡΠ½ΡΠΉ ΡΠ°ΠΉΠ» msi. Π Π΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡΡ ΠΏΡΠΈ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅ ΠΎΡΠΌΠ΅ΡΠΈΡΡ Π³Π°Π»ΠΎΡΠΊΡ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΡ ΠΏΡΡΠΈ Π² ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΡ PATH Π΄Π»Ρ Π²ΡΠ΅Ρ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Π΅ΠΉ. Π’ΠΎΠ³Π΄Π°, ΠΏΠΎΡΠ»Π΅ ΠΏΠ΅ΡΠ΅Π»ΠΎΠ³ΠΈΠ½ΠΈΠ²Π°Π½ΠΈΡ, CMake Π±ΡΠ΄Π΅Ρ Π΄ΠΎΡΡΡΠΏΠ΅Π½ ΠΈΠ· Π»ΡΠ±ΠΎΠ³ΠΎ ΠΌΠ΅ΡΡΠ°. ΠΡΠΎΠ²Π΅ΡΠΈΡΡ ΠΌΠΎΠΆΠ½ΠΎ, ΠΎΡΠΊΡΡΠ² cmd ΠΈ Π²ΡΠΏΠΎΠ»Π½ΠΈΠ² ΡΠΎΡ ΠΆΠ΅
Installing CMake
There are several ways to install CMake, depending on your platform.
Windows
There are pre-compiled binaries available on the Download page for Windows as MSI packages and ZIP files. The Windows installer has an option to modify the system PATH environment variable. If that is not selected during installation, one may manually add the install directory (e.g. C:\Program Files\CMake\bin) to the PATH in a command prompt.
One may alternatively download and build CMake from source. The Download page also provides source releases. In order to build CMake from a source tree on Windows, you must first install the latest binary version of CMake because it is used for building the source tree. Once the binary is installed, run it on CMake as you would any other project. Typically this means selecting CMake as the Source directory and then selecting a binary directory for the resulting executables.
macOS
There are pre-compiled binaries available on the Download page for macOS as disk images and tarballs. After copying CMake.app into /Applications (or a custom location), run it and follow the βHow to Install For Command Line Useβ menu item for instructions to make the command-line tools (e.g. cmake) available in the PATH. Or, one may manually add the install directory (e.g. /Applications/CMake.app/Contents/bin) to the PATH.
One may alternatively download and build CMake from source as in the following section.
Linux, UNIX
There are pre-compiled binaries available on the Download page for some UNIX platforms. One may alternatively download and build CMake from source. The Download page provides source releases. There are two possible approaches for building CMake from a source tree. If there is no existing CMake installation, a bootstrap script is provided:
(Note: the make install step is optional, cmake will run from the build directory.)
Or, an existing CMake installation can be used to build a new version:
(Note: the make install step is optional, cmake will run from the build directory.) If you are not using the GNU C++ compiler, you need to tell the bootstrap script (or cmake) which compiler you want to use. This is done by setting the environment variables CC and CXX before running it. For example:
Download Verification
Each release on the Download page comes with a file named cmake-$version-SHA-256.txt, where $version is the release version number.
One may use this file to verify other downloads, such as the source tarball. For example:
The SHA-256 file itself can be verified by GPG signature:
The GPG key C6C265324BBEBDC350B513D02D2CEF1034921684 is a signing subkey whose expiry is updated yearly.
installΠΒΆ
Specify rules to run at install time.
SynopsisΠΒΆ
IntroductionΠΒΆ
This command generates installation rules for a project. Install rules specified by calls to the install() command within a source directory are executed in order during installation.
Changed in version 3.14: Install rules in subdirectories added by calls to the add_subdirectory() command are interleaved with those in the parent directory to run in the order declared (see policy CMP0082 ).
There are multiple signatures for this command. Some of them define installation options for files and targets. Options common to multiple signatures are covered here but they are valid only for signatures that specify them. The common options are:
Specify the directory on disk to which a file will be installed. Arguments can be relative or absolute paths.
If a relative path is given it is interpreted relative to the value of the CMAKE_INSTALL_PREFIX variable. The prefix can be relocated at install time using the DESTDIR mechanism explained in the CMAKE_INSTALL_PREFIX variable documentation.
If an absolute path (with a leading slash or drive letter) is given it is used verbatim.
As absolute paths are not supported by cpack installer generators, it is preferable to use relative paths throughout. In particular, there is no need to make paths absolute by prepending CMAKE_INSTALL_PREFIX ; this prefix is used by default if the DESTINATION is a relative path.
Specify a list of build configurations for which the install rule applies (Debug, Release, etc.). Note that the values specified for this option only apply to options listed AFTER the CONFIGURATIONS option. For example, to set separate install paths for the Debug and Release configurations, do the following:
Specify that the file is excluded from a full installation and only installed as part of a component-specific installation
Specify a name for an installed file that may be different from the original file. Renaming is allowed only when a single file is installed by the command.
Specify that it is not an error if the file to be installed does not exist.
New in version 3.1: Command signatures that install files may print messages during installation. Use the CMAKE_INSTALL_MESSAGE variable to control which messages are printed.
New in version 3.11: Many of the install() variants implicitly create the directories containing the installed files. If CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is set, these directories will be created with the permissions specified. Otherwise, they will be created according to the uname rules on Unix-like platforms. Windows platforms are unaffected.
Installing TargetsΠΒΆ
The TARGETS form specifies rules for installing targets from a project. There are several kinds of target Output Artifacts that may be installed:
Target artifacts of this kind include:
On AIX, the linker import file created for executables with ENABLE_EXPORTS enabled.
Target artifacts of this kind include:
Shared libraries, except
on macOS when marked as FRAMEWORK (see below).
Target artifacts of this kind include:
DLLs (on all Windows-based systems including Cygwin; note that the accompanying import libraries are of kind ARCHIVE ).
Object files associated with object libraries.
Both static and shared libraries marked with the FRAMEWORK property are treated as FRAMEWORK targets on macOS.
Executables marked with the MACOSX_BUNDLE property are treated as BUNDLE targets on macOS.
Any PUBLIC_HEADER files associated with a library are installed in the destination specified by the PUBLIC_HEADER argument on non-Apple platforms. Rules defined by this argument are ignored for FRAMEWORK libraries on Apple platforms because the associated files are installed into the appropriate locations inside the framework folder. See PUBLIC_HEADER for details.
For each of these arguments given, the arguments following them only apply to the target or file type specified in the argument. If none is given, the installation properties apply to all target types. If only one is given then only targets of that type will be installed (which can be used to install just a DLL or just an import library.)
The following table shows the target types with their associated variables and built-in defaults that apply when no destination is given:
Projects wishing to follow the common practice of installing headers into a project-specific subdirectory will need to provide a destination rather than rely on the above.
In addition to the common options listed above, each target can accept the following additional arguments:
New in version 3.12.
On some platforms a versioned shared library has a symbolic link such as:
Consider the following example:
In this scenario, if you choose to install only the Development component, both the headers and namelink will be installed without the library. (If you don’t also install the Libraries component, the namelink will be a dangling symlink, and projects that link to the library will have build errors.) If you install only the Libraries component, only the library will be installed, without the headers and namelink.
This option is typically used for package managers that have separate runtime and development packages. For example, on Debian systems, the library is expected to be in the runtime package, and the headers and namelink are expected to be in the development package.
See the VERSION and SOVERSION target properties for details on creating versioned shared libraries.
This option causes the installation of only the namelink when a library target is installed. On platforms where versioned shared libraries do not have namelinks or when a library is not versioned, the NAMELINK_ONLY option installs nothing. It is an error to use this parameter outside of a LIBRARY block.
When NAMELINK_ONLY is given, either NAMELINK_COMPONENT or COMPONENT may be used to specify the installation component of the namelink, but COMPONENT should generally be preferred.
The install(TARGETS) command can also accept the following options at the top level:
New in version 3.21.
This option causes all runtime dependencies of installed executable, shared library, and module targets to be added to the specified runtime dependency set. This set can then be installed with an install(RUNTIME_DEPENDENCY_SET) command.
This keyword and the RUNTIME_DEPENDENCIES keyword are mutually exclusive.
New in version 3.21.
RUNTIME_DEPENDENCIES is semantically equivalent to the following pair of calls:
where will be a randomly generated set name. The args. may include any of the following keywords supported by the install(RUNTIME_DEPENDENCY_SET) command:
The RUNTIME_DEPENDENCIES and RUNTIME_DEPENDENCY_SET keywords are mutually exclusive.
will install myExe to
The RUNTIME_DEPENDENCY_SET option causes the runtime artifacts of the imported executable, shared library, and module library targets to be added to the runtime dependency set. This set can then be installed with an install(RUNTIME_DEPENDENCY_SET) command.
Installing FilesΠΒΆ
Projects wishing to follow the common practice of installing headers into a project-specific subdirectory will need to provide a destination rather than rely on the above.
Note that some of the types’ built-in defaults use the DATAROOT directory as a prefix. The DATAROOT prefix is calculated similarly to the types, with CMAKE_INSTALL_DATAROOTDIR as the variable and share as the built-in default. You cannot use DATAROOT as a TYPE parameter; please use DATA instead.
Installing DirectoriesΠΒΆ
The DIRECTORY form installs contents of one or more directories to a given destination. The directory structure is copied verbatim to the destination. The last component of each directory name is appended to the destination directory but a trailing slash may be used to avoid this because it leaves the last component empty. Directory names given as relative paths are interpreted with respect to the current source directory. If no input directory names are given the destination directory will be created but nothing will be installed into it. The FILE_PERMISSIONS and DIRECTORY_PERMISSIONS options specify permissions given to files and directories in the destination. If USE_SOURCE_PERMISSIONS is specified and FILE_PERMISSIONS is not, file permissions will be copied from the source directory structure. If no permissions are specified files will be given the default permissions specified in the FILES form of the command, and the directories will be given the default permissions specified in the PROGRAMS form of the command.
New in version 3.1: The MESSAGE_NEVER option disables file installation status output.
will extract and install header files from a source tree.
Some options may follow a PATTERN or REGEX expression as described under string(REGEX) and are applied only to files or directories matching them. The EXCLUDE option will skip the matched file or directory. The PERMISSIONS option overrides the permissions setting for the matched file or directory. For example the code
Note that some of the types’ built-in defaults use the DATAROOT directory as a prefix. The DATAROOT prefix is calculated similarly to the types, with CMAKE_INSTALL_DATAROOTDIR as the variable and share as the built-in default. You cannot use DATAROOT as a TYPE parameter; please use DATA instead.
New in version 3.5: The list of dirs. given to DIRECTORY may use «generator expressions» too.
Custom Installation LogicΠΒΆ
The SCRIPT form will invoke the given CMake script files during installation. If the script file name is a relative path it will be interpreted with respect to the current source directory. The CODE form will invoke the given CMake code during installation. Code is specified as a single argument inside a double-quoted string. For example, the code
will print a message during installation.
New in version 3.21: When the ALL_COMPONENTS option is given, the custom installation script code will be executed for every component of a component-specific installation. This option is mutually exclusive with the COMPONENT option.
Installing ExportsΠΒΆ
-config.cmake file or the latter may be incorrectly matched by the glob and loaded.
New in version 3.7: In addition to cmake language files, the EXPORT_ANDROID_MK mode maybe used to specify an export to the android ndk build system. This mode accepts the same options as the normal export mode. The Android NDK supports the use of prebuilt libraries, both static and shared. This allows cmake to build the libraries of a project and make them available to an ndk build system complete with transitive dependencies, include flags and defines required to use the libraries.
The EXPORT form is useful to help outside projects use targets built and installed by the current project. For example, the code
will install the executable myexe to
Installs a runtime dependency set previously created by one or more install(TARGETS) or install(IMPORTED_RUNTIME_ARTIFACTS) commands. The dependencies of targets belonging to a runtime dependency set are installed in the RUNTIME destination and component on DLL platforms, and in the LIBRARY destination and component on non-DLL platforms. macOS frameworks are installed in the FRAMEWORK destination and component. Targets built within the build tree will never be installed as runtime dependencies, nor will their own dependencies, unless the targets themselves are installed with install(TARGETS).
ΠΠΎΠ»Π½ΠΎΠ΅ ΡΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²ΠΎ ΠΏΠΎ CMake. Π§Π°ΡΡΡ Π²ΡΠΎΡΠ°Ρ: Π‘ΠΈΡΡΠ΅ΠΌΠ° ΡΠ±ΠΎΡΠΊΠΈ
ΠΠ²Π΅Π΄Π΅Π½ΠΈΠ΅
Π Π΄Π°Π½Π½ΠΎΠΉ ΡΡΠ°ΡΡΠ΅ ΡΠ°ΡΡΠΌΠΎΡΡΠ΅Π½ΠΎ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ ΡΠΈΡΡΠ΅ΠΌΡ ΡΠ±ΠΎΡΠΊΠΈ CMake, ΠΏΡΠΈΠΌΠ΅Π½ΡΠ΅ΠΌΠΎΠΉ Π² ΠΊΠΎΠ»ΠΎΡΡΠ°Π»ΡΠ½ΠΎΠΌ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²Π΅ ΠΏΡΠΎΠ΅ΠΊΡΠΎΠ² Π½Π° C/C++. Π‘ΡΡΠΎΠ³ΠΎ ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡΠ΅ΡΡΡ ΠΏΡΠΎΡΠΈΡΠ°ΡΡ ΠΏΠ΅ΡΠ²ΡΡ ΡΠ°ΡΡΡ ΡΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²Π° Π²ΠΎ ΠΈΠ·Π±Π΅ΠΆΠ°Π½ΠΈΠ΅ Π½Π΅ΠΏΠΎΠ½ΠΈΠΌΠ°Π½ΠΈΡ ΡΠΈΠ½ΡΠ°ΠΊΡΠΈΡΠ° ΡΠ·ΡΠΊΠ° CMake, ΡΠ²Π½ΡΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ ΡΠΈΠ³ΡΡΠΈΡΡΡΡΠ΅Π³ΠΎ Π½Π° ΠΏΡΠΎΡΡΠΆΠ΅Π½ΠΈΠΈ Π²ΡΠ΅ΠΉ ΡΡΠ°ΡΡΠΈ.
ΠΠ°ΠΏΡΡΠΊ CMake
ΠΠΈΠΆΠ΅ ΠΏΡΠΈΠ²Π΅Π΄Π΅Π½Ρ ΠΏΡΠΈΠΌΠ΅ΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ ΡΠ·ΡΠΊΠ° CMake, ΠΏΠΎ ΠΊΠΎΡΠΎΡΡΠΌ ΠΠ°ΠΌ ΡΠ»Π΅Π΄ΡΠ΅Ρ ΠΏΠΎΠΏΡΠ°ΠΊΡΠΈΠΊΠΎΠ²Π°ΡΡΡΡ. ΠΠΊΡΠΏΠ΅ΡΠΈΠΌΠ΅Π½ΡΠΈΡΡΠΉΡΠ΅ Ρ ΠΈΡΡ ΠΎΠ΄Π½ΡΠΌ ΠΊΠΎΠ΄ΠΎΠΌ, ΠΌΠ΅Π½ΡΡ ΡΡΡΠ΅ΡΡΠ²ΡΡΡΠΈΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ ΠΈ Π΄ΠΎΠ±Π°Π²Π»ΡΡ Π½ΠΎΠ²ΡΠ΅. Π§ΡΠΎΠ±Ρ Π·Π°ΠΏΡΡΡΠΈΡΡ Π΄Π°Π½Π½ΡΠ΅ ΠΏΡΠΈΠΌΠ΅ΡΡ, ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΠ΅ CMake Ρ ΠΎΡΠΈΡΠΈΠ°Π»ΡΠ½ΠΎΠ³ΠΎ ΡΠ°ΠΉΡΠ°.
ΠΡΠΈΠ½ΡΠΈΠΏ ΡΠ°Π±ΠΎΡΡ
Π‘ΠΈΡΡΠ΅ΠΌΠ° ΡΠ±ΠΎΡΠΊΠΈ CMake ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΠ΅Ρ ΠΈΠ· ΡΠ΅Π±Ρ ΠΎΠ±ΠΎΠ»ΠΎΡΠΊΡ Π½Π°Π΄ Π΄ΡΡΠ³ΠΈΠΌΠΈ ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ΅Π½Π½ΠΎ Π·Π°Π²ΠΈΡΠΈΠΌΡΠΌΠΈ ΡΡΠΈΠ»ΠΈΡΠ°ΠΌΠΈ (Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, Ninja ΠΈΠ»ΠΈ Make). Π’Π°ΠΊΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ, Π² ΡΠ°ΠΌΠΎΠΌ ΠΏΡΠΎΡΠ΅ΡΡΠ΅ ΡΠ±ΠΎΡΠΊΠΈ, ΠΊΠ°ΠΊ Π±Ρ ΠΏΠ°ΡΠ°Π΄ΠΎΠΊΡΠ°Π»ΡΠ½ΠΎ ΡΡΠΎ Π½ΠΈ Π·Π²ΡΡΠ°Π»ΠΎ, ΠΎΠ½Π° Π½Π΅ΠΏΠΎΡΡΠ΅Π΄ΡΡΠ²Π΅Π½Π½ΠΎΠ³ΠΎ ΡΡΠ°ΡΡΠΈΡ Π½Π΅ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ.
Π‘ΠΈΡΡΠ΅ΠΌΠ° ΡΠ±ΠΎΡΠΊΠΈ CMake ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ Π½Π° Π²Ρ ΠΎΠ΄ ΡΠ°ΠΉΠ» CMakeLists.txt Ρ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ΠΌ ΠΏΡΠ°Π²ΠΈΠ» ΡΠ±ΠΎΡΠΊΠΈ Π½Π° ΡΠΎΡΠΌΠ°Π»ΡΠ½ΠΎΠΌ ΡΠ·ΡΠΊΠ΅ CMake, Π° Π·Π°ΡΠ΅ΠΌ Π³Π΅Π½Π΅ΡΠΈΡΡΠ΅Ρ ΠΏΡΠΎΠΌΠ΅ΠΆΡΡΠΎΡΠ½ΡΠ΅ ΠΈ Π½Π°ΡΠΈΠ²Π½ΡΠ΅ ΡΠ°ΠΉΠ»Ρ ΡΠ±ΠΎΡΠΊΠΈ Π² ΡΠΎΠΌ ΠΆΠ΅ ΠΊΠ°ΡΠ°Π»ΠΎΠ³Π΅, ΠΏΡΠΈΠ½ΡΡΡΡ Π½Π° ΠΠ°ΡΠ΅ΠΉ ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ΅.
Π‘Π³Π΅Π½Π΅ΡΠΈΡΠΎΠ²Π°Π½Π½ΡΠ΅ ΡΠ°ΠΉΠ»Ρ Π±ΡΠ΄ΡΡ ΡΠΎΠ΄Π΅ΡΠΆΠ°ΡΡ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΡΠ΅ Π½Π°Π·Π²Π°Π½ΠΈΡ ΡΠΈΡΡΠ΅ΠΌΠ½ΡΡ ΡΡΠΈΠ»ΠΈΡ, Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΉ ΠΈ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡΠΎΠ², Π² ΡΠΎ Π²ΡΠ΅ΠΌΡ ΠΊΠ°ΠΊ ΠΊΠΎΠΌΠ°Π½Π΄Ρ CMake ΠΎΡΡΠ΄ΡΡΡ Π»ΠΈΡΡ Π°Π±ΡΡΡΠ°ΠΊΡΠ½ΡΠΌ ΠΏΠΎΠ½ΡΡΠΈΠ΅ΠΌ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡΠ° ΠΈ Π½Π΅ ΠΏΡΠΈΠ²ΡΠ·Π°Π½Ρ ΠΊ ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ΅Π½Π½ΠΎ Π·Π°Π²ΠΈΡΠΈΠΌΡΠΌ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ°ΠΌ, ΡΠΈΠ»ΡΠ½ΠΎ ΡΠ°Π·Π»ΠΈΡΠ°ΡΡΠΈΡ ΡΡ Π½Π° ΡΠ°Π·Π½ΡΡ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΎΠ½Π½ΡΡ ΡΠΈΡΡΠ΅ΠΌΠ°Ρ .
ΠΡΠΎΠ²Π΅ΡΠΊΠ° Π²Π΅ΡΡΠΈΠΈ CMake
ΠΠΎΠΌΠ°Π½Π΄Π° cmake_minimum_required ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ Π·Π°ΠΏΡΡΠ΅Π½Π½ΡΡ Π²Π΅ΡΡΠΈΡ CMake: Π΅ΡΠ»ΠΈ ΠΎΠ½Π° ΠΌΠ΅Π½ΡΡΠ΅ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ ΠΌΠΈΠ½ΠΈΠΌΡΠΌΠ°, ΡΠΎ CMake Π·Π°Π²Π΅ΡΡΠ°Π΅Ρ ΡΠ²ΠΎΡ ΡΠ°Π±ΠΎΡΡ ΡΠ°ΡΠ°Π»ΡΠ½ΠΎΠΉ ΠΎΡΠΈΠ±ΠΊΠΎΠΉ. ΠΡΠΈΠΌΠ΅Ρ, Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠΈΡΡΡΡΠΈΠΉ ΡΠΈΠΏΠΈΡΠ½ΠΎΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ Π΄Π°Π½Π½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ Π² Π½Π°ΡΠ°Π»Π΅ Π»ΡΠ±ΠΎΠ³ΠΎ CMake-ΡΠ°ΠΉΠ»Π°:
ΠΠ°ΠΊ ΠΏΠΎΠ΄ΠΌΠ΅ΡΠΈΠ»ΠΈ Π² ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΡΡ , ΠΊΠΎΠΌΠ°Π½Π΄Π° cmake_minimum_required Π²ΡΡΡΠ°Π²Π»ΡΠ΅Ρ Π²ΡΠ΅ ΡΠ»Π°Π³ΠΈ ΡΠΎΠ²ΠΌΠ΅ΡΡΠΈΠΌΠΎΡΡΠΈ (ΡΠΌΠΎΡΡΠ΅ΡΡ cmake_policy ). ΠΠ΅ΠΊΠΎΡΠΎΡΡΠ΅ ΡΠ°Π·ΡΠ°Π±ΠΎΡΡΠΈΠΊΠΈ Π½Π°ΠΌΠ΅ΡΠ΅Π½Π½ΠΎ Π²ΡΡΡΠ°Π²Π»ΡΡΡ Π½ΠΈΠ·ΠΊΡΡ Π²Π΅ΡΡΠΈΡ CMake, Π° Π·Π°ΡΠ΅ΠΌ ΠΊΠΎΡΡΠ΅ΠΊΡΠΈΡΡΡΡ ΡΡΠ½ΠΊΡΠΈΠΎΠ½Π°Π» Π²ΡΡΡΠ½ΡΡ. ΠΡΠΎ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΠΎΠ΄Π½ΠΎΠ²ΡΠ΅ΠΌΠ΅Π½Π½ΠΎ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡ Π΄ΡΠ΅Π²Π½ΠΈΠ΅ Π²Π΅ΡΡΠΈΠΈ CMake ΠΈ ΠΌΠ΅ΡΡΠ°ΠΌΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ Π½ΠΎΠ²ΡΠ΅ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ.
ΠΡΠΎΡΠΌΠ»Π΅Π½ΠΈΠ΅ ΠΏΡΠΎΠ΅ΠΊΡΠ°
Π Π½Π°ΡΠ°Π»Π΅ Π»ΡΠ±ΠΎΠ³ΠΎ CMakeLists.txt ΡΠ»Π΅Π΄ΡΠ΅Ρ Π·Π°Π΄Π°ΡΡ Ρ Π°ΡΠ°ΠΊΡΠ΅ΡΠΈΡΡΠΈΠΊΠΈ ΠΏΡΠΎΠ΅ΠΊΡΠ° ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ project Π΄Π»Ρ Π»ΡΡΡΠ΅Π³ΠΎ ΠΎΡΠΎΡΠΌΠ»Π΅Π½ΠΈΡ ΠΈΠ½ΡΠ΅Π³ΡΠΈΡΠΎΠ²Π°Π½Π½ΡΠΌΠΈ ΡΡΠ΅Π΄Π°ΠΌΠΈ ΠΈ ΠΏΡΠΎΡΠΈΠΌΠΈ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ°ΠΌΠΈ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠΈ.
ΠΠ°ΠΏΡΡΠΊ ΡΠΊΡΠΈΠΏΡΠΎΠ²ΡΡ ΡΠ°ΠΉΠ»ΠΎΠ²
ΠΠΎΠΌΠ°Π½Π΄Π° include Π·Π°ΠΌΠ΅Π½ΡΠ΅Ρ ΡΡΡΠΎΠΊΡ ΡΠ²ΠΎΠ΅Π³ΠΎ Π²ΡΠ·ΠΎΠ²Π° ΠΊΠΎΠ΄ΠΎΠΌ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»Π°, Π΄Π΅ΠΉΡΡΠ²ΡΡ Π°Π½Π°Π»ΠΎΠ³ΠΈΡΠ½ΠΎ ΠΏΡΠ΅ΠΏΡΠΎΡΠ΅ΡΡΠΎΡΠ½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Π΅ include ΡΠ·ΡΠΊΠΎΠ² C/C++. ΠΡΠΎΡ ΠΏΡΠΈΠΌΠ΅Ρ Π·Π°ΠΏΡΡΠΊΠ°Π΅Ρ ΡΠΊΡΠΈΠΏΡΠΎΠ²ΡΠΉ ΡΠ°ΠΉΠ» MyCMakeScript.cmake ΠΎΠΏΠΈΡΠ°Π½Π½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ:
ΠΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ ΠΈΡΠΏΠΎΠ»Π½ΡΠ΅ΠΌΡΡ ΡΠ°ΠΉΠ»ΠΎΠ²
ΠΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊ
ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΈΡΡ ΠΎΠ΄Π½ΠΈΠΊΠΎΠ² ΠΊ ΡΠ΅Π»ΠΈ
ΠΠΎΠ²ΡΠΎΡΡΡΡΠΈΠ΅ΡΡ Π²ΡΠ·ΠΎΠ²Ρ ΠΊΠΎΠΌΠ°Π½Π΄Ρ target_sources Π΄ΠΎΠ±Π°Π²Π»ΡΡΡ ΠΈΡΡ ΠΎΠ΄Π½ΡΠ΅ ΡΠ°ΠΉΠ»Ρ ΠΊ ΡΠ΅Π»ΠΈ Π² ΡΠΎΠΌ ΠΏΠΎΡΡΠ΄ΠΊΠ΅, Π² ΠΊΠ°ΠΊΠΎΠΌ ΠΎΠ½ΠΈ Π±ΡΠ»ΠΈ Π²ΡΠ·Π²Π°Π½Ρ, ΠΏΠΎΡΡΠΎΠΌΡ Π½ΠΈΠΆΠ½ΠΈΠ΅ Π΄Π²Π° Π±Π»ΠΎΠΊΠ° ΠΊΠΎΠ΄Π° ΡΠ²Π»ΡΡΡΡΡ ΡΡΠ½ΠΊΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎ ΡΠΊΠ²ΠΈΠ²Π°Π»Π΅Π½ΡΠ½ΡΠΌΠΈ:
ΠΠ΅Π½Π΅ΡΠΈΡΡΠ΅ΠΌΡΠ΅ ΡΠ°ΠΉΠ»Ρ
ΠΠ°ΠΆΠ½ΠΎ ΠΏΠΎΠ΄ΠΌΠ΅ΡΠΈΡΡ, ΡΡΠΎ «DLL-ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ°ΠΌΠΈ» ΡΡΠΈΡΠ°ΡΡΡΡ Π²ΡΠ΅ ΠΏΠ»Π°ΡΡΠΎΡΠΌΡ, ΠΎΡΠ½ΠΎΠ²Π°Π½Π½ΡΠ΅ Π½Π° Windows, Π² ΡΠΎΠΌ ΡΠΈΡΠ»Π΅ ΠΈ Cygwin.
ΠΠΎΠΌΠΏΠΎΠ½ΠΎΠ²ΠΊΠ° Ρ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ
Π‘ΡΠΎΠΈΡ ΠΎΡΠΌΠ΅ΡΠΈΡΡ, ΡΡΠΎ ΠΌΠΎΠ΄ΡΠ»ΡΠ½ΡΠ΅ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ Π½Π΅ ΠΏΠΎΠ΄Π»Π΅ΠΆΠ°Ρ ΠΊΠΎΠΌΠΏΠΎΠ½ΠΎΠ²ΠΊΠ΅ Ρ ΠΈΡΠΏΠΎΠ»Π½ΡΠ΅ΠΌΡΠΌΠΈ ΡΠ°ΠΉΠ»Π°ΠΌΠΈ ΠΈΠ»ΠΈ Π΄ΡΡΠ³ΠΈΠΌΠΈ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ, ΡΠ°ΠΊ ΠΊΠ°ΠΊ ΠΎΠ½ΠΈ ΠΏΡΠ΅Π΄Π½Π°Π·Π½Π°ΡΠ΅Π½Ρ ΠΈΡΠΊΠ»ΡΡΠΈΡΠ΅Π»ΡΠ½ΠΎ Π΄Π»Ρ Π·Π°Π³ΡΡΠ·ΠΊΠΈ ΡΠ΅Ρ Π½ΠΈΠΊΠ°ΠΌΠΈ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ.
Π Π°Π±ΠΎΡΠ° Ρ ΡΠ΅Π»ΡΠΌΠΈ
ΠΠ°ΠΊ ΡΠΏΠΎΠΌΡΠ½ΡΠ»ΠΈ Π² ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΡΡ , ΡΠ΅Π»ΠΈ Π² CMake ΡΠΎΠΆΠ΅ ΠΏΠΎΠ΄Π²Π΅ΡΠΆΠ΅Π½Ρ ΡΡΡΠ½ΠΎΠΌΡ ΠΌΠ°Π½ΠΈΠΏΡΠ»ΠΈΡΠΎΠ²Π°Π½ΠΈΡ, ΠΎΠ΄Π½Π°ΠΊΠΎ Π²Π΅ΡΡΠΌΠ° ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½Π½ΠΎΠΌΡ.
ΠΠΌΠ΅Π΅ΡΡΡ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΠ²ΠΎΠΉΡΡΠ²Π°ΠΌΠΈ ΡΠ΅Π»Π΅ΠΉ, ΠΏΡΠ΅Π΄Π½Π°Π·Π½Π°ΡΠ΅Π½Π½ΡΡ Π΄Π»Ρ Π·Π°Π΄Π°Π½ΠΈΡ ΠΏΡΠΎΡΠ΅ΡΡΠ° ΡΠ±ΠΎΡΠΊΠΈ ΠΏΡΠΎΠ΅ΠΊΡΠ°. ΠΠΎΠΌΠ°Π½Π΄Π° get_target_property ΠΏΡΠΈΡΠ²Π°ΠΈΠ²Π°Π΅Ρ ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»Π΅Π½Π½ΠΎΠΉ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΠΉ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠ²ΠΎΠΉΡΡΠ²Π° ΡΠ΅Π»ΠΈ. ΠΠ°Π½Π½ΡΠΉ ΠΏΡΠΈΠΌΠ΅Ρ Π²ΡΠ²ΠΎΠ΄ΠΈΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠ²ΠΎΠΉΡΡΠ²Π° C_STANDARD ΡΠ΅Π»ΠΈ MyTarget Π½Π° ΡΠΊΡΠ°Π½:
ΠΡΠΈΠΌΠ΅Ρ Π²ΡΡΠ΅ Π·Π°Π΄Π°Π» ΡΠ΅Π»ΠΈ MyTarget ΡΠ²ΠΎΠΉΡΡΠ²Π°, Π²Π»ΠΈΡΡΡΠΈΠ΅ Π½Π° ΠΏΡΠΎΡΠ΅ΡΡ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ, Π° ΠΈΠΌΠ΅Π½Π½ΠΎ: ΠΏΡΠΈ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ ΡΠ΅Π»ΠΈ MyTarget CMake Π·Π°ΡΡΠ΅Π±ΡΠ΅Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡΠ° ΠΎ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠΈ ΡΡΠ°Π½Π΄Π°ΡΡΠ° C11. ΠΡΠ΅ ΠΈΠ·Π²Π΅ΡΡΠ½ΡΠ΅ ΠΈΠΌΠ΅Π½ΠΎΠ²Π°Π½ΠΈΡ ΡΠ²ΠΎΠΉΡΡΠ² ΡΠ΅Π»Π΅ΠΉ ΠΏΠ΅ΡΠ΅ΡΠΈΡΠ»ΡΡΡΡΡ Π½Π° ΡΡΠΎΠΉ ΡΡΡΠ°Π½ΠΈΡΠ΅.
Π’Π°ΠΊΠΆΠ΅ ΠΈΠΌΠ΅Π΅ΡΡΡ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ ΡΠ°Π½Π΅Π΅ ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ½Π½ΡΡ ΡΠ΅Π»Π΅ΠΉ Ρ ΠΏΠΎΠΌΠΎΡΡΡ ΠΊΠΎΠ½ΡΡΡΡΠΊΡΠΈΠΈ if(TARGET ) :
ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΏΠΎΠ΄ΠΏΡΠΎΠ΅ΠΊΡΠΎΠ²
ΠΠΎΠΌΠ°Π½Π΄Π° add_subdirectory ΠΏΠΎΠ±ΡΠΆΠ΄Π°Π΅Ρ CMake ΠΊ Π½Π΅Π·Π°ΠΌΠ΅Π΄Π»ΠΈΡΠ΅Π»ΡΠ½ΠΎΠΉ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠ΅ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»Π° ΠΏΠΎΠ΄ΠΏΡΠΎΠ΅ΠΊΡΠ°. ΠΡΠΈΠΌΠ΅Ρ Π½ΠΈΠΆΠ΅ Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠΈΡΡΠ΅Ρ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ ΠΎΠΏΠΈΡΠ°Π½Π½ΠΎΠ³ΠΎ ΠΌΠ΅Ρ Π°Π½ΠΈΠ·ΠΌΠ°:
Π‘ΡΠΎΠΈΡ ΠΎΡΠΌΠ΅ΡΠΈΡΡ, ΡΡΠΎ Π²ΡΠ΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ ΠΈΠ· ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΎΠΉ ΠΎΠ±Π»Π°ΡΡΠΈ Π²ΠΈΠ΄ΠΈΠΌΠΎΡΡΠΈ ΡΠ½Π°ΡΠ»Π΅Π΄ΡΡΡΡΡ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½Π½ΡΠΌ ΠΊΠ°ΡΠ°Π»ΠΎΠ³ΠΎΠΌ, Π° Π²ΡΠ΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅, ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ½Π½ΡΠ΅ ΠΈ ΠΏΠ΅ΡΠ΅ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ½Π½ΡΠ΅ Π² Π΄Π°Π½Π½ΠΎΠΌ ΠΊΠ°ΡΠ°Π»ΠΎΠ³Π΅, Π±ΡΠ΄ΡΡ Π²ΠΈΠ΄ΠΈΠΌΡ Π»ΠΈΡΡ Π΅ΠΌΡ (Π΅ΡΠ»ΠΈ ΠΊΠ»ΡΡΠ΅Π²ΠΎΠ΅ ΡΠ»ΠΎΠ²ΠΎ PARENT_SCOPE Π½Π΅ Π±ΡΠ»ΠΎ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠΌ ΠΊΠΎΠΌΠ°Π½Π΄Ρ set ). ΠΠ°Π½Π½ΡΡ ΠΎΡΠΎΠ±Π΅Π½Π½ΠΎΡΡΡ ΡΠΏΠΎΠΌΡΠ½ΡΠ»ΠΈ Π² ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΡΡ ΠΊ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠ΅ΠΉ ΡΡΠ°ΡΡΠ΅.
ΠΠΎΠΈΡΠΊ ΠΏΠ°ΠΊΠ΅ΡΠΎΠ²
ΠΠΎΠΌΠ°Π½Π΄Π° find_package Π½Π°Ρ ΠΎΠ΄ΠΈΡ ΠΈ Π·Π°Π³ΡΡΠΆΠ°Π΅Ρ Π½Π°ΡΡΡΠΎΠΉΠΊΠΈ Π²Π½Π΅ΡΠ½Π΅Π³ΠΎ ΠΏΡΠΎΠ΅ΠΊΡΠ°. Π Π±ΠΎΠ»ΡΡΠΈΠ½ΡΡΠ²Π΅ ΡΠ»ΡΡΠ°Π΅Π² ΠΎΠ½Π° ΠΏΡΠΈΠΌΠ΅Π½ΡΠ΅ΡΡΡ Π΄Π»Ρ ΠΏΠΎΡΠ»Π΅Π΄ΡΡΡΠ΅ΠΉ Π»ΠΈΠ½ΠΊΠΎΠ²ΠΊΠΈ Π²Π½Π΅ΡΠ½ΠΈΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊ, ΡΠ°ΠΊΠΈΡ ΠΊΠ°ΠΊ Boost ΠΈ GSL. ΠΠ°Π½Π½ΡΠΉ ΠΏΡΠΈΠΌΠ΅Ρ Π²ΡΠ·ΡΠ²Π°Π΅Ρ ΠΎΠΏΠΈΡΠ°Π½Π½ΡΡ ΠΊΠΎΠΌΠ°Π½Π΄Ρ Π΄Π»Ρ ΠΏΠΎΠΈΡΠΊΠ° Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ GSL ΠΈ ΠΏΠΎΡΠ»Π΅Π΄ΡΡΡΠ΅ΠΉ Π»ΠΈΠ½ΠΊΠΎΠ²ΠΊΠΈ:
Π ΠΎΠ±ΡΠ΅ΠΌ ΡΠ»ΡΡΠ°Π΅, ΠΊΠΎΠΌΠ°Π½Π΄Π° find_package ΠΈΠΌΠ΅Π΅Ρ Π΄Π²Π΅ ΡΠ°Π·Π½ΠΎΠ²ΠΈΠ΄Π½ΠΎΡΡΠΈ Π·Π°ΠΏΡΡΠΊΠ°: ΠΌΠΎΠ΄ΡΠ»ΡΠ½ΡΡ ΠΈ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΎΠ½Π½ΡΡ. ΠΡΠΈΠΌΠ΅Ρ Π²ΡΡΠ΅ ΠΏΡΠΈΠΌΠ΅Π½ΡΠ» ΠΌΠΎΠ΄ΡΠ»ΡΠ½ΡΡ ΡΠΎΡΠΌΡ. ΠΡΠΎ ΠΎΠ·Π½Π°ΡΠ°Π΅Ρ, ΡΡΠΎ Π²ΠΎ Π²ΡΠ΅ΠΌΡ Π²ΡΠ·ΠΎΠ²Π° ΠΊΠΎΠΌΠ°Π½Π΄Ρ CMake ΠΈΡΠ΅Ρ ΡΠΊΡΠΈΠΏΡΠΎΠ²ΡΠΉ ΡΠ°ΠΉΠ» Π²ΠΈΠ΄Π° Find
Π‘ΠΏΠΎΡΠΎΠ±Ρ Π²ΠΊΠ»ΡΡΠ΅Π½ΠΈΡ Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠΎΠ²
ΠΠΎΠΌΠ°Π½Π΄Π° target_include_directories Π²Π»ΠΈΡΠ΅Ρ Π»ΠΈΡΡ Π½Π° ΡΠΊΠ°Π·Π°Π½Π½ΡΡ ΠΏΠ΅ΡΠ²ΡΠΌ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠΌ ΡΠ΅Π»Ρ, Π° Π½Π° Π΄ΡΡΠ³ΠΈΠ΅ ΡΠ΅Π»ΠΈ Π½ΠΈΠΊΠ°ΠΊΠΎΠ³ΠΎ Π²ΠΎΠ·Π΄Π΅ΠΉΡΡΠ²ΠΈΡ Π½Π΅ ΠΎΠΊΠ°Π·ΡΠ²Π°Π΅ΡΡΡ. ΠΡΠΈΠΌΠ΅Ρ Π½ΠΈΠΆΠ΅ Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠΈΡΡΠ΅Ρ ΡΠ°Π·Π½ΠΈΡΡ ΠΌΠ΅ΠΆΠ΄Ρ ΡΡΠΈΠΌΠΈ Π΄Π²ΡΠΌΡ ΠΊΠΎΠΌΠ°Π½Π΄Π°ΠΌΠΈ:
Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° ΠΏΡΠΎΠ΅ΠΊΡΠ°
ΠΠΎΠΌΠ°Π½Π΄Π° install Π³Π΅Π½Π΅ΡΠΈΡΡΠ΅Ρ ΡΡΡΠ°Π½ΠΎΠ²ΠΎΡΠ½ΡΠ΅ ΠΏΡΠ°Π²ΠΈΠ»Π° Π΄Π»Ρ ΠΠ°ΡΠ΅Π³ΠΎ ΠΏΡΠΎΠ΅ΠΊΡΠ°. ΠΠ°Π½Π½Π°Ρ ΠΊΠΎΠΌΠ°Π½Π΄Π° ΡΠΏΠΎΡΠΎΠ±Π½Π° ΡΠ°Π±ΠΎΡΠ°ΡΡ Ρ ΡΠ΅Π»ΡΠΌΠΈ, ΡΠ°ΠΉΠ»Π°ΠΌΠΈ, ΠΏΠ°ΠΏΠΊΠ°ΠΌΠΈ ΠΈ ΠΌΠ½ΠΎΠ³ΠΈΠΌ Π΄ΡΡΠ³ΠΈΠΌ. Π‘ΠΏΠ΅ΡΠ²Π° ΡΠ°ΡΡΠΌΠΎΡΡΠΈΠΌ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΡ ΡΠ΅Π»Π΅ΠΉ.
ΠΠΎΡΠ»Π΅ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΡ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠΈ CMake Π²ΡΠ΅Ρ ΠΠ°ΡΠΈΡ ΡΠ°ΠΉΠ»ΠΎΠ² ΠΡ ΠΌΠΎΠΆΠ΅ΡΠ΅ Π²ΡΠΏΠΎΠ»Π½ΠΈΡΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΡ Π²ΡΠ΅Ρ ΠΎΠΏΠΈΡΠ°Π½Π½ΡΡ ΠΎΠ±ΡΠ΅ΠΊΡΠΎΠ² ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ sudo checkinstall (Π΅ΡΠ»ΠΈ CMake Π³Π΅Π½Π΅ΡΠΈΡΡΠ΅Ρ Makefile ), ΠΈΠ»ΠΈ ΠΆΠ΅ Π²ΡΠΏΠΎΠ»Π½ΠΈΡΡ Π΄Π°Π½Π½ΠΎΠ΅ Π΄Π΅ΠΉΡΡΠ²ΠΈΠ΅ ΠΈΠ½ΡΠ΅Π³ΡΠΈΡΠΎΠ²Π°Π½Π½ΠΎΠΉ ΡΡΠ΅Π΄ΠΎΠΉ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠΈ, ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡΠ΅ΠΉ CMake.
ΠΠ°Π³Π»ΡΠ΄Π½ΡΠΉ ΠΏΡΠΈΠΌΠ΅Ρ ΠΏΡΠΎΠ΅ΠΊΡΠ°
ΠΠ°Π½Π½ΠΎΠ΅ ΡΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²ΠΎ Π±ΡΠ»ΠΎ Π±Ρ Π½Π΅ΠΏΠΎΠ»Π½ΡΠΌ Π±Π΅Π· Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠ°ΡΠΈΠΈ ΡΠ΅Π°Π»ΡΠ½ΠΎΠ³ΠΎ ΠΏΡΠΈΠΌΠ΅ΡΠ° ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ ΡΠΈΡΡΠ΅ΠΌΡ ΡΠ±ΠΎΡΠΊΠΈ CMake. Π Π°ΡΡΠΌΠΎΡΡΠΈΠΌ ΡΡ Π΅ΠΌΡ ΠΏΡΠΎΡΡΠΎΠ³ΠΎ ΠΏΡΠΎΠ΅ΠΊΡΠ°, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡΡΠ΅Π³ΠΎ CMake Π² ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π΅Π΄ΠΈΠ½ΡΡΠ²Π΅Π½Π½ΠΎΠΉ ΡΠΈΡΡΠ΅ΠΌΡ ΡΠ±ΠΎΡΠΊΠΈ:
ΠΠ°ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅
Π’Π΅ΠΏΠ΅ΡΡ ΠΡ ΡΠΏΠΎΡΠΎΠ±Π½Ρ ΠΏΠΈΡΠ°ΡΡ ΡΠ²ΠΎΠΈ ΠΈ ΠΏΠΎΠ½ΠΈΠΌΠ°ΡΡ ΡΡΠΆΠΈΠ΅ CMake-ΡΠ°ΠΉΠ»Ρ, Π° ΠΏΠΎΠ΄ΡΠΎΠ±Π½ΠΎ ΠΏΡΠΎΡΠΈΡΠ°ΡΡ ΠΏΡΠΎ ΠΎΡΡΠ°Π»ΡΠ½ΡΠ΅ ΠΌΠ΅Ρ Π°Π½ΠΈΠ·ΠΌΡ ΠΡ ΠΌΠΎΠΆΠ΅ΡΠ΅ Π½Π° ΠΎΡΠΈΡΠΈΠ°Π»ΡΠ½ΠΎΠΌ ΡΠ°ΠΉΡΠ΅.
Π‘Π»Π΅Π΄ΡΡΡΠ°Ρ ΡΡΠ°ΡΡΡ Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΡΠΊΠΎΠ²ΠΎΠ΄ΡΡΠ²Π° Π±ΡΠ΄Π΅Ρ ΠΏΠΎΡΠ²ΡΡΠ΅Π½Π° ΡΠ΅ΡΡΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΈ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ ΠΏΠ°ΠΊΠ΅ΡΠΎΠ² Ρ ΠΏΠΎΠΌΠΎΡΡΡ CMake ΠΈ Π²ΡΠΉΠ΄Π΅Ρ ΡΠ΅ΡΠ΅Π· Π½Π΅Π΄Π΅Π»Ρ. ΠΠΎ ΡΠΊΠΎΡΡΡ Π²ΡΡΡΠ΅Ρ!