CMake/Make

notepad·2022년 11월 10일
0

C++

목록 보기
1/1

단일 파일 Compile

g++ main.cpp
./a.out

다수 파일 Compile

g++ *.cpp
./a.out

CMake 를 활용한 Compile
대규모 프로젝트라면 보통 Cmake 기반으로 프로젝트를 관리.
외부라이브러리 관리등은 Cmake로 진행하여
다른플랫폼에서의 사용성을 보장.

해당 포스트트 CmakeLists 작성에 사용되는 옵션들에 대해 정리해나갈 예정

CmakeLists.txt가 프로젝트 최상단에 위치

mkdir build
cd build
cmake ..
make
./your_executable_name

참고
The first line directs the cmake command at the top-level CMakeLists.txt file with ... This command uses the CMakeLists.txt to configure the project and create a Makefile in the build directory.
In the second line, make finds the Makefile and uses the instructions in the Makefile to build the project.

0개의 댓글