Skip to content

Instantly share code, notes, and snippets.

@wvovaw
Created May 7, 2021 16:01
Show Gist options
  • Save wvovaw/64c01ef33ae5caa84392a2c8558737b9 to your computer and use it in GitHub Desktop.
Save wvovaw/64c01ef33ae5caa84392a2c8558737b9 to your computer and use it in GitHub Desktop.
CMakeLists.txt for C/C++ projects
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME myProject)
project(${PROJECT_NAME} VERSION 1.0 LANGUAGES CXX) # OR C
set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
file(GLOB_RECURSE SOURCE_FILES src/*)
file(GLOB_RECURSE SOURCE_HEADERS include/*)
set(SOURCES ${SOURCE_FILES} ${SOURCE_HEADERS})
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE include/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment