DrawingProcess
λ“œν”„ DrawingProcess
DrawingProcess
전체 방문자
였늘
μ–΄μ œ
Β«   2025/05   Β»
일 μ›” ν™” 수 λͺ© 금 ν† 
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
  • λΆ„λ₯˜ 전체보기 (964)
    • Profile & Branding (22)
      • Career (15)
    • IT Trends (254)
      • Conference, Faire (Experien.. (31)
      • News (187)
      • Youtube (19)
      • TED (8)
      • Web Page (2)
      • IT: Etc... (6)
    • Contents (97)
      • Book (66)
      • Lecture (31)
    • Project Process (94)
      • Ideation (0)
      • Study Report (34)
      • Challenge & Award (22)
      • 1Day1Process (5)
      • Making (5)
      • KRC-FTC (Team TC(5031, 5048.. (10)
      • GCP (GlobalCitizenProject) (15)
    • Study: ComputerScience(CS) (72)
      • CS: Basic (9)
      • CS: Database(SQL) (5)
      • CS: Network (14)
      • CS: OperatingSystem (3)
      • CS: Linux (39)
      • CS: Etc... (2)
    • Study: Software(SW) (95)
      • SW: Language (29)
      • SW: Algorithms (1)
      • SW: DataStructure & DesignP.. (1)
      • SW: Opensource (15)
      • SW: Error Bug Fix (43)
      • SW: Etc... (6)
    • Study: Artificial Intellige.. (149)
      • AI: Research (1)
      • AI: 2D Vision(Det, Seg, Tra.. (35)
      • AI: 3D Vision (70)
      • AI: MultiModal (3)
      • AI: SLAM (0)
      • AI: Light Weight(LW) (3)
      • AI: Data Pipeline (7)
      • AI: Machine Learning(ML) (1)
    • Study: Robotics(Robot) (33)
      • Robot: ROS(Robot Operating .. (9)
      • Robot: Positioning (8)
      • Robot: Planning & Control (7)
    • Study: DeveloperTools(DevTo.. (83)
      • DevTool: Git (12)
      • DevTool: CMake (13)
      • DevTool: NoSQL(Elastic, Mon.. (25)
      • DevTool: Container (17)
      • DevTool: IDE (11)
      • DevTool: CloudComputing (4)
    • 인생을 μ‚΄λ©΄μ„œ (64)
      • λ‚˜μ˜ μ·¨λ―Έλ“€ (7)
      • λ‚˜μ˜ 생각듀 (42)
      • 여행을 λ– λ‚˜μž~ (10)
      • 뢄기별 회고 (5)

개발자 λͺ…μ–Έ

β€œ λ§€μ£Ό λͺ©μš”μΌλ§ˆλ‹€ 당신이 항상 ν•˜λ˜λŒ€λ‘œ μ‹ λ°œλˆμ„ 묢으면 μ‹ λ°œμ΄ ν­λ°œν•œλ‹€κ³  생각해보라.
컴퓨터λ₯Ό μ‚¬μš©ν•  λ•ŒλŠ” 이런 일이 항상 μΌμ–΄λ‚˜λŠ”λ°λ„ 아무도 λΆˆν‰ν•  생각을 μ•ˆ ν•œλ‹€. ”

- Jef Raskin

λ§₯의 아버지 - μ• ν”Œμ»΄ν“¨ν„°μ˜ λ§€ν‚¨ν† μ‹œ ν”„λ‘œμ νŠΈλ₯Ό 주도

인기 κΈ€

졜근 κΈ€

졜근 λŒ“κΈ€

ν‹°μŠ€ν† λ¦¬

hELLO Β· Designed By μ •μƒμš°.
DrawingProcess

λ“œν”„ DrawingProcess

[CMake] configure_file(): CMake λ³€μˆ˜κ°’μ„ μ†ŒμŠ€μ½”λ“œμ—μ„œ μ‚¬μš©!
Study: DeveloperTools(DevTool)/DevTool: CMake

[CMake] configure_file(): CMake λ³€μˆ˜κ°’μ„ μ†ŒμŠ€μ½”λ“œμ—μ„œ μ‚¬μš©!

2022. 7. 4. 15:46
λ°˜μ‘ν˜•
πŸ’‘ λ³Έ λ¬Έμ„œλŠ” 'CMake λ³€μˆ˜κ°’을 μ†ŒμŠ€μ½”λ“œμ—μ„œ μ‚¬μš©ν•˜λŠ” 방법'에 λŒ€ν•΄ 정리해놓은 κΈ€μž…λ‹ˆλ‹€.
configure_file을 톡해 CMake λ³€μˆ˜κ°’μ„ μ†ŒμŠ€μ½”λ“œμ—μ„œ μ‚¬μš©ν•˜λŠ” 방법에 λŒ€ν•΄ μ •λ¦¬ν•˜μ˜€μœΌλ‹ˆ μ°Έκ³ ν•˜μ‹œκΈ° λ°”λžλ‹ˆλ‹€.

1. ν”„λ‘œμ νŠΈ ꡬ성

1.1 CMakeLists.txt 파일: configure_file μ‚¬μš©

CMakeLists.txtμ—μ„œ μ„€μ •ν•œ λ³€μˆ˜κ°’μ„ μ†ŒμŠ€νŒŒμΌμ—μ„œλ„ μ‚¬μš©ν•˜κΈ° μœ„ν•œ configure_file ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€!
μ°¨κ·Όμ°¨κ·Ό CMakeLists.txt을 μ™œ μ΄λ ‡κ²Œ μž‘μ„±ν–ˆλŠ”μ§€, μ†ŒμŠ€μ— λŒ€ν•΄ μ„€λͺ…ν•΄λ“œλ¦¬κ² μŠ΅λ‹ˆλ‹€. 

...
option(USING_NLOHMANNJSON "using nlohmann_json" ON)
option(USING_LEVELDB "using leveldb" ON)

# configure a header file to pass some of the CMake settings to the source code
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/include/config.h)

add_library(${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
  PUBLIC
    ${PROJECT_BINARY_DIR}/include
    ...
)
...

+ configure_file()

configure_file λͺ…λ Ήμ–΄λŠ” μ–΄λ– ν•œ νŒŒμΌμ„ λ‹€λ₯Έ μœ„μΉ˜μ— λ³΅μ‚¬ν•˜κ±°λ‚˜ CMake λ³€μˆ˜κ°’λ“€μ„ νŒŒμΌμ— μ“Έ 수 μžˆλ„λ‘ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

# configure a header file to pass some of the CMake settings
# to the source code
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/include/config.h)
  • 첫 번째 argumentλŠ” μ†ŒμŠ€κ°€ λ˜λŠ” 파일이며,
  • 두 번째 argumentλŠ” 결과물의 파일λͺ…μž…λ‹ˆλ‹€.
    (μ ˆλŒ€κ²½λ‘œκ°€ μ•„λ‹Œ 파일λͺ…λ§Œ μž…λ ₯ν•˜λ©΄, ν˜„μž¬ CMakeLists.txtκ°€ μ‘΄μž¬ν•˜λŠ” 경둜λ₯Ό κΈ°μ€€μœΌλ‘œ μƒλŒ€κ²½λ‘œλ‘œ μΈμ‹ν•˜κ²Œ λ©λ‹ˆλ‹€.)

1.2 config.h.cmake λ˜λŠ” config.h.in 파일 λ§Œλ“€κΈ°

생성할 ν—€λ”νŒŒμΌμ˜ 포맷이 λ˜λŠ” 파일인 config.h.cmakeμ΄λ‚˜ config.h.inλ₯Ό μ •μ˜ν•΄μ£Όμ–΄μ•Ό ν•©λ‹ˆλ‹€. 참고둜, 두 νŒŒμΌμ€ ν™•μž₯자만 λ‹€λ₯Ό 뿐 λ™μΌν•œ μ†ŒμŠ€λ‘œ κ΅¬μ„±λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€!

// the configured options and settings for Tutorial
#define VERSION_MAJOR @VERSION_MAJOR@
#define VERSION_MINOR @VERSION_MINOR@
  • define을 ν†΅ν•΄μ„œ Tutorial_VERSION_MAJOR와 Tutorial_VERSION_MINORλ₯Ό μ •μ˜ν•΄μ£ΌλŠ”λ° μ΄ κ°’은 CMakeμ—μ„œ μ •μ˜λœ λ²„μ „ λ³€μˆ˜λͺ…μœΌλ‘œ μ ‘κ·Όν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. 
  • CMake λ³€μˆ˜μ— μ ‘κ·Όν•˜κΈ° μœ„ν•΄μ„œ λ³€μˆ˜λͺ…μ˜ μ–‘ λμ„ '@'둜 κ°μ‹Έμ£Όλ©΄ λ˜λŠ”λ°, '@'둜 κ°μ‹Έμ£Όκ²Œ λ˜λ©΄ configure_file을 ν†΅ν•΄μ„œ νŒŒμΌμ΄ copy될 λ•Œ, ν•΄λ‹Ή λ³€μˆ˜μ˜ κ°’μœΌλ‘œ λŒ€μ²΄λ˜κ²Œ λ©λ‹ˆλ‹€.
    • λ”°λΌμ„œ, CMake λ‚΄μ—μ„œ optionμ΄λ‚˜ set으둜 λ³€μˆ˜λ₯Ό μ •μ˜ν•œ 후에 configure_file λͺ…λ Ήμ–΄λ₯Ό 톡해 μ„€μ • νŒŒμΌμ„ 생성해야 μƒμ„±λœ νŒŒμΌμ— λ°˜μ˜λ©λ‹ˆλ‹€!
    • option(USING_NLOHMANNJSON "using nlohmann_json" ON)
      option(USING_LEVELDB "using leveldb" ON)
      configure_file("config.h.cmake" ${PROJECT_BINARY_DIR}/include/piclUtilCfg.h)

2. ν”„λ‘œμ νŠΈ λΉŒλ“œ

cmake ..으둜 λΉŒλ“œνŒŒμΌμ„ μƒμ„±ν•˜λ©΄, ${PROJECT_BINARY_DIR}인 build 폴더 λ‚΄ include/piclUtilCfg.h파일이 생긴 것을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

μƒμ„±λœ ν—€λ”νŒŒμΌ μ‚¬μš©ν•˜κΈ°

μ΄λ ‡κ²Œ μƒμ„±λœ ν—€λ”νŒŒμΌμ„ μš°λ¦¬κ°€ 생성할 μ‹€ν–‰νŒŒμΌ(즉, μ†ŒμŠ€μ½”λ“œ)μ—μ„œ μ‚¬μš©ν•˜λ €λ©΄, 

  • add_library λͺ…λ Ήμ–΄λ₯Ό 톡해 라이브러리λ₯Ό λ§Œλ“€κ³ ,
  • target_include_directories λͺ…λ Ήμ–΄λ₯Ό ν†΅ν•΄μ„œ include μ‹œμΌœμ£Όμ–΄μ•Ό ν•©λ‹ˆλ‹€.
add_library(${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
  PUBLIC
    ${PROJECT_BINARY_DIR}/include
    ...
)

μ°Έκ³ 

  • [Blog] Tutorial (1) - Start CMake: https://junstar92.tistory.com/204
λ°˜μ‘ν˜•
μ €μž‘μžν‘œμ‹œ λΉ„μ˜λ¦¬ λ³€κ²½κΈˆμ§€

'Study: DeveloperTools(DevTool) > DevTool: CMake' μΉ΄ν…Œκ³ λ¦¬μ˜ λ‹€λ₯Έ κΈ€

[CMake] make package νŒ¨ν‚€μ§€ (feat. cmake install)  (0) 2022.07.14
[CMake] λ³€μˆ˜ 및 이미 μ •μ˜λœ 맀크둜 κ°’λ“€  (0) 2022.07.07
[CMake] function: λ°˜λ³΅λ˜λŠ” μž‘μ—…μ€ ν•¨μˆ˜ν™”ν•˜μž!  (0) 2022.06.28
[CMake] 크둜슀 ν”Œλž«νΌ λΉŒλ“œ ν™˜κ²½ ꡬ좕  (0) 2022.06.24
[CMake] FetchContent: μ™ΈλΆ€ 라이브러리λ₯Ό μ‚¬μš©ν•˜μž~  (0) 2022.06.24
    'Study: DeveloperTools(DevTool)/DevTool: CMake' μΉ΄ν…Œκ³ λ¦¬μ˜ λ‹€λ₯Έ κΈ€
    • [CMake] make package νŒ¨ν‚€μ§€ (feat. cmake install)
    • [CMake] λ³€μˆ˜ 및 이미 μ •μ˜λœ 맀크둜 κ°’λ“€
    • [CMake] function: λ°˜λ³΅λ˜λŠ” μž‘μ—…μ€ ν•¨μˆ˜ν™”ν•˜μž!
    • [CMake] 크둜슀 ν”Œλž«νΌ λΉŒλ“œ ν™˜κ²½ ꡬ좕
    DrawingProcess
    DrawingProcess
    과정을 그리자!

    ν‹°μŠ€ν† λ¦¬νˆ΄λ°”