enable_language — CMake 4.0.2 Documentation (original) (raw)

Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)

enable_language(... [OPTIONAL])

Enables support for the named languages in CMake. This is the same as the project() command but does not create any of the extra variables that are created by the project() command.

Supported languages are C, CXX (i.e. C++), CSharp (i.e. C#), CUDA,OBJC (i.e. Objective-C), OBJCXX (i.e. Objective-C++), Fortran, HIP,ISPC, Swift, ASM, ASM_NASM, ASM_MARMASM, ASM_MASM, and ASM-ATT.

Added in version 3.8: Added CSharp and CUDA support.

Added in version 3.15: Added Swift support.

Added in version 3.16: Added OBJC and OBJCXX support.

Added in version 3.18: Added ISPC support.

Added in version 3.21: Added HIP support.

Added in version 3.26: Added ASM_MARMASM support.

If enabling ASM, list it last so that CMake can check whether compilers for other languages like C work for assembly too.

The following restrictions apply to where enable_language() may be called:

The OPTIONAL keyword is a placeholder for future implementation and does not currently work. Instead you can use the CheckLanguagemodule to verify support before enabling.