λ°μν
π‘ λ³Έ λ¬Έμλ 'CMake μκ° λ° νμμ±'μ λν΄ μ 리ν΄λμ κΈμ λλ€.
C/C++ νλ‘μ νΈμ λΉλλ₯Ό μ©μ΄νκ² ν΄μ£Όλ CMakeμ λν κ°λ΅ν μκ° λ° κ΄λ ¨ μλ£λ€μ μ 리νμμΌλ μ°Έκ³ νμκΈ° λ°λλλ€.
1. CMake λ?
- Makeμ λΉλκ΄λ¦¬μμ€ν μ λ§λ€κΈ° μν μ€νμμ€ νλ‘μ νΈ(Make μ΄μΈμ .ninjaμ κ°μ λΉλ νμΌλ λ§λ€ μ μμ).
- μ€μ€λ‘ κΈ°μ‘΄μ Makeμ κ³Όμ μ μννμ§λ μκ³ μ§μ ν μ΄μ 체μ μ λ§λ Make νμΌμ μμ± λ° κ΄λ¦¬λ§μ μννκΈ° λλ¬Έμ Meta MakeλΌκ³ λ λΆλ¦¬μ°λ λΉλ μλν μμ€ν .
- νλ² μμ±ν΄ λλ©΄ μ λμ€ κ³μ΄μ λ¬Όλ‘ , λ§μ΄ν¬λ‘μννΈ window κ³μ΄μ νλ‘κ·Έλλ° λꡬλ μ§μ.
2. μ CMakeλ₯Ό μ¬μ©νλ κ±ΈκΉ?
- You want to avoid hard-coding paths
- You need to build a package on more than one computer
- You want to use CI (continuous integration)
- You need to support different OSs (maybe even just flavors of Unix)
- You want to support multiple compilers
- You want to use an IDE, but maybe not all of the time
- You want to describe how your program is structured logically, not flags and commands
- You want to use a library
- You want to use tools, like Clang-Tidy, to help you code
- You want to use a debugger
- You want to use a CTest(unit test), CPack(auto installer)
3. CMakeλ₯Ό 곡λΆνκΈ° μν μ’μ μλ£λ€
Official CMake help
- The official help: Really amazing documentation. Nicely organized, great search, and you can toggle versions at the top. It just doesn't have a great "best practices tutorial", which is what this book tries to fill in.
- User Interaction Guide: This will detail the steps needed to run the cmake(1) or cmake-gui(1) executable and how to choose a generator, and how to complete the build.
- Using Dependencies Guide: This aimed at developers wishing to get started using a third-party library.
- CMake Tutorial: For developers starting a project using CMake
- cmake-buildsystem(7): manual is aimed at developers expanding their knowledge of maintaining a buildsystem and becoming familiar with the build targets that can be represented in CMake.
- cmake-packages(7): manual explains how to create packages which can easily be consumed by third-party CMake-based buildsystems.
Other material from the original author of this book:
There are some other places to find good information on the web. Here are some of them:
- An Introduction to Modern CMake: Introduction Modern CMake & Syntax
- ν΄λΉ λ΄μ©μ λν λ²μλ³Έμ [CMake] An Introduction to Modern CMake μ 리λ₯Ό μ°Έκ³ νλ€.
- Effective Modern CMake: A great list of do's and don'ts.
- ν΄λΉ λ΄μ©μ λν λ²μλ³Έμ [CMake] Effective Modern CMake.mdλ₯Ό μ°Έκ³ νλ€.
- CMake 3.21 (νκ΅μ΄): cmakeμ λͺ λ Ή, νκ²½λ³μ, κ°μ΄λ, λ©λ΄μΌ, λͺ¨λ λ± νλνλ μμ μ ν¨κ» μ€λͺ λμ΄ μλ€(νκ΅μ΄ λ²μλ³Έ).
- Embracing Modern CMake: A post with good description of the term
- It's time to do CMake Right: A nice set of best practices for Modern CMake projects.
- The Ultimate Guide to Modern CMake: A slightly dated post with similar intent.
- More Modern CMake: A great presentation from Meeting C++ 2018 that recommends CMake 3.12+. This talk makes calls CMake 3.0+ "Modern CMake" and CMake 3.12+ "More Modern CMake".
- Oh No! More Modern CMake: The sequel to More Modern CMake.
- toeb/moderncmake: A nice presentation and examples about CMake 3.5+, with intro to syntax through project organization
CMake Practice: Basic Template
- cmake-for-all: λλΆλΆμ C++ νλ‘μ νΈμμ μ¬μ©ν μ μλ λ§λ₯ CMake νλ‘μ νΈ ν νλ¦Ώ.
4. λ§λ¬΄λ¦¬
- λ³Έ λ¬Έμμμλ λΉλλ₯Ό μν CMakeμ μ΄λ₯Ό μ¬μ©ν΄μΌνλ μ΄μ λ° μ°Έκ³ νλ©΄ μ’μ μλ£μ λν΄ λ€λ£¨μμΌλ©°,
- λ€μ κΈμμλ μ°Έκ³ νλ©΄ μ’μ μλ£ μ€ Modern CMakeμ λν΄ λ€λ£¬ κΈμ μμ½ μ 리νμ¬ μκ°ν©λλ€.
- μμΌλ‘ λΉλ νκ²½μ ꡬμΆνκΈ° μν CMakefileμ ꡬμ±νλ©° μ μν΄μΌν μ λ μ°¨μ°¨ μκ°ν κ²μ΄λ λ§κ΄λΆ.
μ°Έκ³
- [CMake]Official CMake help: https://cmake.org/cmake/help/latest/index.html
- [GitLab.io] Modern CMake: https://cliutils.gitlab.io/modern-cmake/
- [GitLab] Modern CMake: https://gitlab.com/CLIUtils/modern-cmake
λ°μν
'Study: DeveloperTools(DevTool) > DevTool: CMake' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[CMake] FetchContent: μΈλΆ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©νμ~ (0) | 2022.06.24 |
---|---|
[CMake] Effective Modern CMake μ 리 (0) | 2022.06.24 |
[CMake] An Introduction to Modern CMake μ 리 (0) | 2022.06.24 |
[CMake] Makefile λ° CMakeμ νμμ± μ 리 (2) | 2022.06.24 |
[C++] C++ λΉλ μμ€ν (ν΄)μλ λκ° μμκΉ? (0) | 2022.06.24 |