Contains specific CMake commands to manage project, assembly informations and application properties.
These specific CMake commands are automatically added when you add find_package(xtd REQUIRED) to your CMakeLists.txt file.
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
- xtd Specific CMake commands
-
- xtd Specific CMake variables
-
Generic commands
choice_options
Provides a choice options for the user to select an option from options list.
- Parameters
-
OPTION | the option to set. |
MESSAGE | Description message for the choice options. |
DEFAULT_OPTION | The default option. |
... | Other options. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
choice_options(TARGET_TYPE "Choose library dynamic, static, interface or module" DYNAMIC_LIBRARY STATIC_LIBRARY INTERFACE_LIBRARY MODULE_LIBRARY)
target_type(${TARGET_TYPE})
Target properties commands
target_categories
- Parameters
-
MAIN_CATEGORY | Main categories to set. |
ARGV0 | One or more additional categories to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_categories(Development IDE GUIDesigner)
target_type(CONSOLE_APPLICATION)
target_default_namespace
Specifies the the base namespace for files added to the project.
- Parameters
-
TARGET_DEFAULT_NAMESPACE | the namespace to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_default_namespace("my_namespace")
target_type(CONSOLE_APPLICATION)
target_display
Specifies if application is displaying in GNOME or KDE menu.
- Parameters
-
TARGET_DISPLAY | option to display (ON or OFF) |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_display(ON)
target_type(GUI_APPLICATION)
target_icon
Specifies the icon file (.ico for Windows, icons for maOS and png or svg for linux) that you want to use as your program icon.
- Parameters
-
ARGV0 | the icon to set without extension. It can be empty. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_icon(my_icon)
target_type(CONSOLE_APPLICATION)
target_name
Specifies the name of the output file.
- Parameters
-
TARGET_NAME | the name to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_name("my_exe")
target_type(CONSOLE_APPLICATION)
target_registered
Specify the application is registered in the system.
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_registered(OFF)
target_type(GUI_APPLICATION)
target_startup
Specifies the entry point to be called when the application is load.
- Parameters
-
ARGV0 | the object that contains the entry point. |
ARGV1 | the object definition file. (optional if you use TUnitMain_ or TUnitFrameworkMain_ entry point) |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
target_startup("my_project::my_class" my_project.cpp)
target_type(GUI_APPLICATION)
target_type
Specifies the type of application to build.
- Parameters
-
TARGET_TYPE | Type of application. Possible values :
- CONSOLE_APPLICATION Console application
- GUI_APPLICATION Gui application (Winforms)
- TEST_APPLICATION Test application (TUnit)
- MODULE_LIBRARY Module library
- SHARED_LIBRARY Shared library (.dll or .so)
- STATIC_LIBRARY Static library (.lib or .a)
- INTERFACE_LIBRARY Interface library (header files only)
- CUSTOM_TARGET Target with no output.
|
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
add_references(
xtd.drawing
xtd.drawing.native)
target_type(CONSOLE_APPLICATION)
Assembly informations commands
assembly_company
Specifies a company name for the assembly manifest. Corresponds to AssemblyCompanyAttribute.
- Parameters
-
ASSEMBLY_COMPANY | The company name to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_company("Gammasoft")
target_type(GUI_APPLICATION)
assembly_configuration
Specifies a configuration for the assembly manifest. Corresponds to AssemblyConfigurationAttribute.
- Parameters
-
ASSEMBLY_CONFIGURATION | The configuration to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_configuration("Beta public")
target_type(GUI_APPLICATION)
assembly_copyright
Specifies a copyright notice for the assembly manifest. Corresponds to AssemblyCopyrightAttribute.
- Parameters
-
ASSEMBLY_COPYRIGHT | The copyright to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_copyright("© 2024 by Gammasoft.")
target_type(GUI_APPLICATION)
assembly_culture
Specifies the culture for the assembly manifest. Corresponds to AssemblyConfigurationAttribute.
- Parameters
-
ASSEMBLY_CONFIGURATION | The culture to set. |
assembly_description
Specifies an optional description for the assembly manifest. Corresponds to AssemblyDescriptionAttribute.
- Parameters
-
ASSEMBLY_DESCRIPTION | The description to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_description("The application to stuff it.")
target_type(GUI_APPLICATION)
assembly_file_version
Specifies a version number that instructs the compiler to use a specific version for the Win32 file version resource. Corresponds to AssemblyFileVersionAttribute.
- Parameters
-
ASSEMBLY_FILE_VERSION | The file version to set (Major, Minor and build). |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_file_version("1.2.3")
target_type(GUI_APPLICATION)
assembly_guid
Specifies an unique GUID that identifies the assembly. When you create a project, Visual Studio generates a GUID for the assembly. Corresponds to Guid.
- Parameters
-
ASSEMBLY_GUID | The guid to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_guid("fc5beb89-a4cc-445e-8ef7-07a9e471ef9a")
target_type(GUI_APPLICATION)
assembly_product
Specifies a product name for the assembly manifest. Corresponds to AssemblyProductAttribute.
- Parameters
-
ASSEMBLY_PRODUCT | The product name to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_product("my_project")
target_type(GUI_APPLICATION)
assembly_title
Specifies a title for the assembly manifest. Corresponds to AssemblyTitleAttribute.
- Parameters
-
ASSEMBLY_TITLE | The title to set. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_title("My Project")
target_type(GUI_APPLICATION)
assembly_trademark
Specifies a trademark for the assembly manifest. Corresponds to AssemblyTrademarkAttribute.
- Parameters
-
ASSEMBLY_TRADEMARK | The trademark to set. |
assembly_version
Specifies the version of the assembly. Corresponds to AssemblyVersionAttribute.
- Parameters
-
ASSEMBLY_FILE_VERSION | The version to set (Major, Minor and build). |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
assembly_version("1.2.3")
target_type(GUI_APPLICATION)
Build options commands
build_output_directory
Specifies the directory into which runtime target files should be built.
- Parameters
-
OUTPUT_DIRECTORY | the directory where runtime target files should be built. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(MySolution)
find_package(
xtd REQUIRED)
build_output_directory("${USER_DIRECTORY}/Output")
add_projects(lib_project1 lib_project2 lib_project3)
add_projects(tests/test_lib_project1 tests/test_lib_project2 tests/test_lib_project3)
Install commands
add_install_include_directories
Installs include directories.
- Parameters
-
ARGN | Include directories to install. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(src/my_project1.cpp src/my_project2.cpp include/my_project/my_project.h include/my_project/MyProject2.h)
target_type(STATIC_LIBRARY)
add_install_include_directories(include/my_project)
install_component()
install_application()
add_install_include_files
Installs include files.
- Parameters
-
ARGN | Include files to install. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project1.cpp my_project2.cpp my_project.h MyProject2.h)
target_type(STATIC_LIBRARY)
install_include_files(my_project1.h my_project2.h)
install_component()
install_application()
install_component
- Parameters
-
ARGV0 | Install name (optional). |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp my_project.h)
target_type(STATIC_LIBRARY)
add_install_include_files(my_project.h)
install_component()
install_package()
install_package
Installs package MODULE_LIBRARY, STATIC_LIBRARY or SHARED_LIBRARY package.
- Parameters
-
ARGV0 | Install name (optional). |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp my_project.h)
target_type(STATIC_LIBRARY)
add_install_include_files(my_project.h)
install_component()
install_package()
install_name
Specifies the install name.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp my_project.h)
target_type(STATIC_LIBRARY)
install_name("specific_project")
add_install_include_files(my_project.h)
install_component()
install_application()
Project commands
add_include_directories
Add include directory to current project.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_include_directories(include)
add_sources(my_project.cpp include/my_project/my_project.h)
target_type(STATIC_LIBRARY)
add_packages
Adds, finds and loads settings from external required projects to current project.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_packages(my_package1 my_package2)
add_references(my_project1_in_my_package1 my_project1_in_my_package2 my_project2_in_my_package2)
add_sources(my_project.cpp)
target_type(CONSOLE_APPLICATION)
add_projects
Add child projects to parent project.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(MySolution)
find_package(
xtd REQUIRED)
add_projects(lib_project1 lib_project2 lib_project3)
add_projects(tests/test_lib_project1 tests/test_lib_project2 tests/test_lib_project3)
add_references
Add references (libraries) to current project.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(my_project.cpp)
add_references(
xtd.drawing
xtd.drawing.native)
target_type(CONSOLE_APPLICATION)
resource
Add resources to current project.
- Parameters
-
NAME | resource name to add. |
FILE | resource file to add. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(file.h file.cpp)
resource(image1 resources/image1.png)
resource(image2 resources/image2.bmp)
resource(animation1 animations/ani1.gif)
target_type(CONSOLE_APPLICATION)
resource_string
Add resource string to current project.
- Parameters
-
NAME | Name of string to add. |
VALUE | Value of string to add. |
COMMENT | Comment of string to add. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(file.h file.cpp)
resource_string(caption "\"Form examples\"" "Caption of main Form.")
resource_string(button_close_text "\"Close\"" "Text of close button.")
target_type(GUI_APPLICATION)
setting
Add a setting to current project.
- Parameters
-
NAME | The name of setting to add. |
TYPE | The type of setting to add. |
SCOPE | The scope of setting to add (APPLICATION or USER). |
VALUE | The value of setting to add. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(file.h file.cpp)
setting(name
xtd::
string APPLICATION "\"Settings example\"")
setting(back_color
xtd::drawing::color USER "
xtd::drawing::color::spring_green")
target_type(CONSOLE_APPLICATION)
setting_include
Adds a setting include file to current project.
- Parameters
-
SETTIING_INCLUDE_FILE | The include file to add. |
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(file.h file.cpp)
setting_include("
xtd/drawing/color")
setting_include("
xtd/
string")
setting(name
xtd::
string APPLICATION "\"Settings example\"")
setting(back_color
xtd::drawing::color USER "
xtd::drawing::color::spring_green")
target_type(CONSOLE_APPLICATION)
add_sources
Add source and header files to current project.
- Parameters
-
- Examples
cmake_minimum_required(VERSION 3.20)
project(my_project)
find_package(
xtd REQUIRED)
add_sources(file1.h file2.h options/file3.h)
add_sources(file1.cpp file2.cpp options/file3.cpp)
target_type(CONSOLE_APPLICATION)
Target properties Variables
TARGET_CATEGORIES
Contains the application categories.
- See also
- target_categories
TARGET_DEFAULT_NAMESPACE
Contains default namespace use by application.
- See also
- target_default_namespace
TARGET_ICON
Contains application icon file name without extension.
- See also
- target_icon
TARGET_NAME
Contains application name.
- See also
- target_name
TARGET_REGISTERED
Contains boolean that specify if application is registered or not on the system.
TARGET_TYPE
Contains application type.
- See also
- target_type
Assembly informations Variables
ASSEMBLY_COMPANY
Contains assembly company name.
- See also
- assembly_company
ASSEMBLY_CONFIGURATION
Contains assembly configuration string.
- See also
- assembly_configuration
ASSEMBLY_COPYRIGHT
Contains assembly copyright string.
- See also
- assembly_copyright
ASSEMBLY_CULTURE
Contains assembly culture information.
- See also
- assembly_culture
ASSEMBLY_DESCRIPTION
Contains assembly description string.
- See also
- assembly_description
ASSEMBLY_FILE_VERSION
Contains assembly file version number.
- See also
- assembly_file_version
ASSEMBLY_GUID
Contains assembly guid string.
- See also
- assembly_guid
ASSEMBLY_PRODUCT
Contains assembly product string.
- See also
- assembly_product
ASSEMBLY_TITLE
Contains assembly title string.
- See also
- assembly_title
ASSEMBLY_TRADEMARK
Contains assembly trademark information.
- See also
- assembly_trademark
ASSEMBLY_VERSION
Contains assembly version number.
- See also
- assembly_version
Build options Variables
BUILD_OUTPUT_DIRECTORY
Contains build output directory.
- See also
- build_output_directory
BUILD_TYPE
Contains build type.
Install Variables
INSTALL_COMPONENTS
Contains install project components.
- See also
- install_component
INSTALL_INCLUDE_DIRECTORIES
Contains install include directories.
- See also
- add_install_include_directories
INSTALL_INCLUDE_FILES
Contains install include files.
- See also
- add_install_include_files
INSTALL_NAME
Contains install name.
- See also
- install_name
Project Variables
PROJECT_APPLICATION_SETTINGS
Contains project application settings.
- See also
- setting
PROJECT_INCLUDE_DIRECTORIES
Contains include directories.
- See also
- add_include_directories
PROJECT_PACKAGES
Contains project packages.
- See also
- add_packages
PROJECT_PROJECTS
Contains solution or project projects.
- See also
- add_projects
PROJECT_REFERENCES
Contains project references.
- See also
- add_references
PROJECT_RESOURCES
Contains project resources.
- See also
- resource
PROJECT_RESOURCE_STRINGS
Contains project resource strings.
- See also
- resource_string
PROJECT_SETTING_INCLUDE_FILES
Contains project setting include files.
- See also
- setting_include
PROJECT_SOURCES
Contains project sources.
- See also
- add_sources
PROJECT_USER_SETTINGS
Contains project user settings.
- See also
- setting
System Variables
USER_DIRECTORY
The path to user home.