lukka / run-cmake

GitHub Action to build C++ applications with CMake (CMakePresets.json), Ninja and vcpkg on GitHub.
MIT License
173 stars 19 forks source link

Option for passing additional arguments to cmake #85

Closed Kicer86 closed 1 year ago

Kicer86 commented 1 year ago

It would be useful to me if I could pass additional arguments to CMake (not specified in present file). In my case I'd like to set CMAKE_C(XX)_COMPILER_LAUNCHER variables.

lukka commented 1 year ago

@Kicer86 I think that is just an environment variable that you could set in the CMakePresets.json file.

Note that it is an intentional choice to have the build process entirely driven by the CMakePresets.json content, and anything external and not specified in the file would defeat the purpose of the file itself, i.e. reproducible/identical builds by developer and CI machines.

Kicer86 commented 1 year ago

But if I use env variable then there is no difference if I pass additional variables right to cmake or set env variables which I use later in CMakePresets - in both cases builds are not reproducible.

lukka commented 1 year ago

@Kicer86 please note you can define the environment variable in the CMakePresets.json file itself, like this:

 "environment": {
        "MY_ENVIRONMENT_VARIABLE": "Test",
        "PATH": "$env{HOME}/ninja/bin:$penv{PATH}"
      },

In practice what I am suggesting is to let the build be driven entirely by the content of CMakePresets.json file, and nothing else.

Do not hesitate to report back your findings and your feedback about this.

lukka commented 1 year ago

@Kicer86 does my last comment make sense and helped you? Please follow up if this issue is not solved, thanks!