Skip to content

Instantly share code, notes, and snippets.

@harderthan
Last active November 27, 2018 02:10
Show Gist options
  • Save harderthan/3e5254c1d105ea6c936bb7178c17e73c to your computer and use it in GitHub Desktop.
Save harderthan/3e5254c1d105ea6c936bb7178c17e73c to your computer and use it in GitHub Desktop.
CMakeLists 예제
cmake_minimum_required(VERSION x.x.x FATAL_ERROR)
# Project에 필요한 최소한의 cmake 버전을 명시
project(PackageName)
# Project 이름을 지정, 여기서 패키지 이름은 ${PROJECT_NAME} 변수에 저장
find_package(Library_Name REQUIRED)
# 추가할 Library Package를 지정
set(Var_Name Val)
set(Path_Name ${Sample_Path})
set(SOURCE
main.cpp
A.cpp
)
set(LIBRARIES
${Lib}
Example
)
# 변수를 선언
include(Configuration_Name)
# 추가 구성파일을 포함
include_directories(${Sample_Include_DIR})
# 포함 경로 추가
add_executable(${PROJECT_NAME} ${SOURCES})
# 소스 파일들로부터 PROJECT_NAME이라는 실행파일을 가지는 빌드
target_link_libraries(${PROJECT_NAME} LIBRARIES)
# 타겟에 필요한 라이브러리들을 링크
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment