From 785ba148140763971693131710f179a80cb428fb Mon Sep 17 00:00:00 2001 From: Rober Morales-Chaparro Date: Wed, 26 Mar 2025 21:14:27 +0100 Subject: [PATCH 1/2] Added options.cmake, with CMAKE_EXPORT_COMPILE_COMMANDS ON This commit solves #170 It adds one options.cmake file to allow for flags configuration. The only flag added so far is CMAKE_EXPORT_COMPILE_COMMANDS To test: cmake -S all -B build/ find . -name compile_commands.json --> ./build/compile_commands.json --- all/CMakeLists.txt | 1 + cmake/options.cmake | 1 + 2 files changed, 2 insertions(+) create mode 100644 cmake/options.cmake diff --git a/all/CMakeLists.txt b/all/CMakeLists.txt index 8092382..b9ca365 100644 --- a/all/CMakeLists.txt +++ b/all/CMakeLists.txt @@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.14...3.22) project(BuildAll LANGUAGES CXX) +include(../cmake/options.cmake) include(../cmake/tools.cmake) # needed to generate test target diff --git a/cmake/options.cmake b/cmake/options.cmake new file mode 100644 index 0000000..87f9c87 --- /dev/null +++ b/cmake/options.cmake @@ -0,0 +1 @@ +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) From 118165080c3b8489ee07b0f7f6ba72b1d4d8c9b9 Mon Sep 17 00:00:00 2001 From: Rober Morales-Chaparro Date: Wed, 26 Mar 2025 21:54:11 +0100 Subject: [PATCH 2/2] adding the options to test and standalone targets too --- standalone/CMakeLists.txt | 1 + test/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/standalone/CMakeLists.txt b/standalone/CMakeLists.txt index a932149..c923fa3 100644 --- a/standalone/CMakeLists.txt +++ b/standalone/CMakeLists.txt @@ -4,6 +4,7 @@ project(GreeterStandalone LANGUAGES CXX) # --- Import tools ---- +include(../cmake/options.cmake) include(../cmake/tools.cmake) # ---- Dependencies ---- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74cd08d..b8ea4ea 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,7 @@ option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) # --- Import tools ---- +include(../cmake/options.cmake) include(../cmake/tools.cmake) # ---- Dependencies ----