Created
September 12, 2023 18:37
-
-
Save arash28134/92c0e332aeb72429d321d4ddb44174e1 to your computer and use it in GitHub Desktop.
Example CMakeLists.txt for basic projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File strcuture: | |
# | |
# Test Project/ | |
# ├─ CMakeLists.txt | |
# ├─ src/ | |
# │ ├─ *.cpp | |
# ├─ include/ | |
# │ ├─ *.h | |
# │ ├─ *.hpp | |
cmake_minimum_required(VERSION 3.14) | |
project(test) # <--- Your project name | |
set(CMAKE_CXX_STANDARD 20) | |
set(SOURCE_DIR ${PROJECT_SOURCE_DIR}/src) | |
set(HEADER_DIR ${PROJECT_SOURCE_DIR}/include) | |
file(GLOB_RECURSE SOURCE_FILES ${SOURCE_DIR}/*.cpp) | |
add_executable(${PROJECT_NAME} ${SOURCE_FILES}) | |
target_compile_options(${PROJECT_NAME} PRIVATE -Wall) | |
target_include_directories(${PROJECT_NAME} PRIVATE ${HEADER_DIR}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment