๋ฐ์ํ
๐ก ๋ณธ ๋ฌธ์๋ '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] An Introduction to Modern CMake ์ ๋ฆฌ
๋ํ DrawingProcess [CMake] An Introduction to Modern CMake ์ ๋ฆฌ ๋ณธ๋ฌธ Study: SW(Software)/SW: Etc... [CMake] An Introduction to Modern CMake ์ ๋ฆฌ ๋ํ 2022. 6. 20. 16:04 Prev 1 2 3 4 5 6 7 8 9 10 ยทยทยท 375 Next
csj000714.tistory.com
์ฐธ๊ณ
- [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 |