기타

[Cmake] Cmake 와 Google test

vhxpffltm 2022. 1. 27. 22:10
반응형

예전 파이프라인을 관리하면서 오류가 하도 터져서 찾아보니 여기까지 왔다....

 

최근에는 업데이트가 이루어지면서 Google test의 공식 document에서 제공하는 것처럼 쉽게 사용할 수 있다.

 

아래와 같이 사용할 수 있으며 상세 내용은 공식 문서에서 확인할 수 있다.

 

이렇게 tests 폴더에 라이브러리를 다운받도록 하고 각 테스에 사용하게끔 타겟을 맞춰주면 쉽게 사용할 수 있을것이다.

 

 

 

예전 Google test를 Cmake와 적용하는 방법은 아래와 같다.

 

보통 CmakeLists.txt 파일에 CmakeLists.txt.in을 외부 라이브러리로 사용한다.

 

 

 

 

https://google.github.io/googletest/quickstart-cmake.html

 

Quickstart: Building with CMake

GoogleTest - Google Testing and Mocking Framework

google.github.io

 

https://crascit.com/2015/07/25/cmake-gtest/

 

Building GoogleTest and GoogleMock directly in a CMake project

Arguably the most flexible, robust way to incorporate gtest or gmock into a CMake project.

crascit.com

 

 

반응형

'기타' 카테고리의 다른 글

[Blockchain] 테스트서버에 코인만들기  (0) 2022.02.03
[python] sqlacodegen 데이터 ORM  (0) 2022.01.27
[vscode] python format 설정과 launch.json  (0) 2022.01.19
[vscode] python 설정  (0) 2022.01.19
[vscode] Ctrl + tap 탭 이동  (0) 2021.11.14