Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure extension using CMakePresets/'testPresets' #55

Open
pJunger opened this issue Jul 26, 2022 · 2 comments
Open

Configure extension using CMakePresets/'testPresets' #55

pJunger opened this issue Jul 26, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@pJunger
Copy link

pJunger commented Jul 26, 2022

CMake added support for test presets in their CMakePresets.json file.
With CLion & VS Code starting to support this format now it seems like a good way to configure all build & test configurations in one place.
It would be great if this extension would be able to read those configurations as well.

@fredericbonnet fredericbonnet added the enhancement New feature or request label Aug 4, 2022
@fredericbonnet
Copy link
Owner

Thanks for the suggestion! Do you have usage examples? The doc page is not very explicit.

@pJunger
Copy link
Author

pJunger commented Sep 14, 2022

Sorry, I don't have any real usage examples that I can share.

I've cobbled something together that might help though:

{
  "version": 4,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 23,
    "patch": 0
  },
  "include": [
    "CMake/compilers.json"
  ],
  "configurePresets": [
    {
      "name": "dev_test",
      "cacheVariables": {
        "BUILD_TESTS": "ON",
        "BUILD_EXAMPLES": "ON",
        "BUILD_DOCS": "ON"
      },
      "hidden": true
    },
    {
      "name": "dev_clang11_linux_x86_64",
      "inherits": ["clang11_linux_x86_64", "dev_test"],
      "binaryDir": "build/dev_clang11_linux_x86_64",
      "installDir": "${sourceDir}/build/install/dev_clang11_linux_x86_64",
	  "generator": "Ninja Multi-Config"
    },
  ],
  "buildPresets": [
    {
      "name": "dev_clang11_linux_x86_64",
      "configurePreset": "dev_clang11_linux_x86_64",
      "configuration": "Debug",
      "jobs": 12
    }
  ],
  "testPresets": [
    {
      "name": "test_mod_1",
      "configurePreset": "dev_clang11_linux_x86_64",
      "configuration": "Debug",
	  "output": {
        "outputOnFailure": true
      },
      "execution": {
        "noTestsAction": "error",
        "stopOnFailure": true
      },
      "filter": {
        "include": {
          "name": "some_regex"
        },
        "exclude": {
          "name": "some_other_regex"
        }
      }
    }
  ]
}

Also an issue about integrating this extension with the cmake-tools extension exists here: microsoft/vscode-cmake-tools#1682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants