GCC
Helpers and utilities that are specific for GNU Compiler Collection (GCC).
Table of Contents
Compile Option Presets
Strict
Use RSP_GCC_STRICT_COMPILE_OPTIONS
preset when you wish to enable strict compile options.
include("rsp/compiler")
add_compile_options(${RSP_GCC_STRICT_COMPILE_OPTIONS})
For additional information, please review the RSP_GCC_STRICT_COMPILE_OPTIONS
list, in the source code.
Customize
If you need to customise a preset, create a copy of the desired preset, and use cmake’s list operations to remove or append options.
# Copy provided preset into new variable
set(my_compile_options "${RSP_GCC_STRICT_COMPILE_OPTIONS}")
# Modify your preset...
list(REMOVE_ITEM my_compile_options "-Wswitch-default")
gcc_info()
Available Since: v0.3.0
Obtains the path and version of the installed GCC version. The function accepts the following parameters:
OUTPUT
: Output variable to assign the result to.
Output
[OUTPUT]
: Path to installed GCC tool.[OUTPUT]_VERSION
: GCC version.
Example
gcc_info(OUTPUT gcc)
message("GCC (path): ${gcc}") # /usr/bin/g++-14
message("GCC (version): ${gcc_VERSION}") # 14.2.0
gcc_version()
Available Since: v0.2.0
Obtains the installed GCC version. The function accepts the following parameters:
OUTPUT
: Output variable to assign the result to.
gcc_version(OUTPUT version)
message("GCC: ${version}") # 14.2.0