CMAKE_<LANG>_COMPILER — CMake 4.4.2 Documentation

# CMAKE_<LANG>_COMPILER

The full path to the compiler for `LANG`.

This is the command that will be used as the `<LANG>` compiler. Once set, you can not change this variable.

Note

With IDE Build Tool Generators, including Visual Studio Generators and `Xcode`, this variable is computed automatically and should not be set. Instead, specify a toolset using `cmake -T`.

## Usage

With Command-Line Build Tool Generators this variable can be set by the user during the first time a build tree is configured.

If a non-full path value is supplied then CMake will resolve the full path of the compiler.

The variable could be set in a user supplied toolchain file or via `-D` on the command line.

Note

Options that are required to make the compiler work correctly can be included as items in a list; they can not be changed.

    #set within user supplied toolchain file
    set(CMAKE_C_COMPILER /full/path/to/qcc --arg1 --arg2)

or

    $ cmake ... -DCMAKE_C_COMPILER='qcc;--arg1;--arg2'