|
@@ -22,17 +22,23 @@ Languages
|
|
|
|
|
|
|
|
Languages are enabled by the :command:`project` command. If no project command
|
|
Languages are enabled by the :command:`project` command. If no project command
|
|
|
is in the top-level CMakeLists file, one will be implicitly generated. By default
|
|
is in the top-level CMakeLists file, one will be implicitly generated. By default
|
|
|
-the enabled languages are C and CXX::
|
|
|
|
|
|
|
+the enabled languages are C and CXX:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
project(C_Only C)
|
|
project(C_Only C)
|
|
|
|
|
|
|
|
A special value of NONE can also be used with the :command:`project` command
|
|
A special value of NONE can also be used with the :command:`project` command
|
|
|
-to enable no languages::
|
|
|
|
|
|
|
+to enable no languages:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
project(MyProject NONE)
|
|
project(MyProject NONE)
|
|
|
|
|
|
|
|
The :command:`enable_language` command can be used to enable languages after the
|
|
The :command:`enable_language` command can be used to enable languages after the
|
|
|
-:command:`project` command::
|
|
|
|
|
|
|
+:command:`project` command:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
enable_language(CXX)
|
|
enable_language(CXX)
|
|
|
|
|
|
|
@@ -86,7 +92,9 @@ Cross Compiling
|
|
|
If :manual:`cmake(1)` is invoked with the command line parameter
|
|
If :manual:`cmake(1)` is invoked with the command line parameter
|
|
|
``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set
|
|
``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set
|
|
|
values for the compilers. A typical cross-compiling toolchain has content such
|
|
values for the compilers. A typical cross-compiling toolchain has content such
|
|
|
-as::
|
|
|
|
|
|
|
+as:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
|
|
|
|
|
@@ -127,7 +135,9 @@ the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables.
|
|
|
|
|
|
|
|
Some compilers are inherently cross compilers, such as Clang and the QNX QCC
|
|
Some compilers are inherently cross compilers, such as Clang and the QNX QCC
|
|
|
compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
|
|
compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
|
|
|
-value to those supported compilers when compiling::
|
|
|
|
|
|
|
+value to those supported compilers when compiling:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
|
|
|
|
|
@@ -138,7 +148,9 @@ value to those supported compilers when compiling::
|
|
|
set(CMAKE_CXX_COMPILER clang++)
|
|
set(CMAKE_CXX_COMPILER clang++)
|
|
|
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
|
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
|
|
|
|
|
|
|
-Or, for QCC::
|
|
|
|
|
|
|
+Or, for QCC:
|
|
|
|
|
+
|
|
|
|
|
+.. code-block:: cmake
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME QNX)
|
|
set(CMAKE_SYSTEM_NAME QNX)
|
|
|
|
|
|