cmake_minimum_required(VERSION 3.9) project(MyProject) set(CMAKE_CXX_STANDARD 17) set(SOURCE_FILES main.cpp) add_executable(${CMAKE_PROJECT_NAME}_run ${SOURCE_FILES}) include_directories(src) add_subdirectory(src) target_link_libraries(${CMAKE_PROJECT_NAME}_run ${CMAKE_PROJECT_NAME}_lib)