VS Code CMake Helper: first implementation (#1)
Build / build (push) Successful in 9m40s

CMake the way CLion does it (profiles and presets, targets, run and debug
configurations, CTest)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tomáš Černík <Tom.cernik@gmail.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
committed 2026-10-26 17:56:59 +00:00
1 parent f8032fd65d
commit 093cf7ee9c
38 files changed
+9352

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# A small project to try the extension on: F5 "Run Extension (example)".
cmake_minimum_required(VERSION 3.20)
project(example CXX)
set(CMAKE_CXX_STANDARD 17)
add_library(greet src/greet.cpp)
target_include_directories(greet PUBLIC src)
add_executable(hello src/main.cpp)
target_link_libraries(hello PRIVATE greet)
enable_testing()
add_executable(greet_test tests/greet_test.cpp)
target_link_libraries(greet_test PRIVATE greet)
add_test(NAME greet COMMAND greet_test)
# Custom targets: ▶ builds them (runs their command), 🐞 debugs the program their command runs.
add_custom_target(run_hello
COMMAND hello CMake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running hello")
add_custom_target(run_hello_env
COMMAND ${CMAKE_COMMAND} -E env GREETING=hi $<TARGET_FILE:hello> "with spaces"
COMMAND ${CMAKE_COMMAND} -E echo done)
+5
View File
@@ -0,0 +1,5 @@
#include "greet.h"
std::string greet(const std::string& name) {
return "Hello, " + name + "!";
}
+4
View File
@@ -0,0 +1,4 @@
#pragma once
#include <string>
std::string greet(const std::string& name);
+7
View File
@@ -0,0 +1,7 @@
#include <iostream>
#include "greet.h"
int main(int argc, char** argv) {
std::cout << greet(argc > 1 ? argv[1] : "world") << std::endl;
return 0;
}
+10
View File
@@ -0,0 +1,10 @@
#include <iostream>
#include "greet.h"
int main() {
if (greet("CMake") != "Hello, CMake!") {
std::cerr << "unexpected greeting: " << greet("CMake") << std::endl;
return 1;
}
return 0;
}