diff options
| author | Frédéric Desbiens <[email protected]> | 2026-10-02 10:42:44 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-10-02 10:42:44 -0400 |
| commit | 93387b0a60382a29579bbad5045c68328e3751df (patch) | |
| tree | 42be790d602cb76f55090e5a7c418df7ea2b3428 /cmake/linux.cmake | |
| parent | 44d7c95c582d415c4ad84527180b29c93c3bf664 (diff) | |
| parent | 28281cd5647d4671236ca08d19bd18ed15b2265a (diff) | |
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'cmake/linux.cmake')
| -rw-r--r-- | cmake/linux.cmake | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/cmake/linux.cmake b/cmake/linux.cmake index 192425c6..55cd5e00 100644 --- a/cmake/linux.cmake +++ b/cmake/linux.cmake @@ -1,8 +1,25 @@ set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR x86_64) -set(CMAKE_C_COMPILER gcc) -set(CMAKE_CXX_COMPILER g++) +# Let the compiler be chosen on the command line or from the environment, for example +# -DCMAKE_C_COMPILER=gcc-14 or CC=gcc-14. CMake reads a toolchain file before it consults +# CC and CXX, so setting these unconditionally would quietly override both and leave no +# way to build with anything but the distribution's default gcc. +if(NOT DEFINED CMAKE_C_COMPILER) + if(DEFINED ENV{CC}) + set(CMAKE_C_COMPILER $ENV{CC}) + else() + set(CMAKE_C_COMPILER gcc) + endif() +endif() + +if(NOT DEFINED CMAKE_CXX_COMPILER) + if(DEFINED ENV{CXX}) + set(CMAKE_CXX_COMPILER $ENV{CXX}) + else() + set(CMAKE_CXX_COMPILER g++) + endif() +endif() set(AS as) set(AR ar) set(OBJCOPY objcopy) |
