enable_language¶
Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)
enable_language(<lang>... [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.
The supported languages are:
C
CXXC++
CSharpДобавлено в версии 3.8.
C#
CUDAДобавлено в версии 3.8.
OBJCДобавлено в версии 3.16.
Objective-C
OBJCXXДобавлено в версии 3.16.
Objective-C++
Fortran
HIPДобавлено в версии 3.21.
ISPCДобавлено в версии 3.18.
SwiftДобавлено в версии 3.15.
ASMAssembly language supported by the C compiler.
If enabling
ASM, list it last so that CMake can check whether theCorCXXcompiler supports assembly.ASM_NASMNetwide Assembler
ASM_MARMASMДобавлено в версии 3.26.
Microsoft Assembler (ARM, ARM64)
ASM_MASMMicrosoft Assembler (x86, x64)
ASM_POASMДобавлено в версии 4.4.
Pelles C toolchain assembler.
ASM-ATTAT&T-syntax assembler (e.g. GNU
as)
The following restrictions apply to where enable_language() may be called:
It must not be called before the first call to
project(). See policyCMP0165.It must be called such that the command executes before any targets that use the language directly for compiling sources or indirectly through link dependencies.
Примечание
Further restrictions apply if policy CMP0220 is not set
to NEW. See the policy documentation for details.
The OPTIONAL keyword is a placeholder for future implementation and
does not currently work. Instead you can use the CheckLanguage
module to verify support before enabling.