SM0 She11
Path:
/
/
usr
/
share
/
cmake3
/
Help
/
command
Full Path (server): /usr/share/cmake3/Help/command
Create Fil3
Upl04d Fil3
📄 FIND_XXX.txt
[E]
[D]
[R]
📄 FIND_XXX_ORDER.txt
[E]
[D]
[R]
📄 FIND_XXX_ROOT.txt
[E]
[D]
[R]
📄 LINK_OPTIONS_LINKER.txt
[E]
[D]
[R]
📄 OPTIONS_SHELL.txt
[E]
[D]
[R]
📄 add_compile_definitions.rst
[E]
[D]
[R]
📄 add_compile_definitions.rst.rename
[E]
[D]
[R]
📄 add_compile_options.rst
[E]
[D]
[R]
📄 add_compile_options.rst.rename
[E]
[D]
[R]
📄 add_custom_command.rst
[E]
[D]
[R]
📄 add_custom_command.rst.rename
[E]
[D]
[R]
📄 add_custom_target.rst
[E]
[D]
[R]
📄 add_custom_target.rst.rename
[E]
[D]
[R]
📄 add_definitions.rst
[E]
[D]
[R]
📄 add_definitions.rst.rename
[E]
[D]
[R]
📄 add_dependencies.rst
[E]
[D]
[R]
📄 add_executable.rst
[E]
[D]
[R]
📄 add_executable.rst.rename
[E]
[D]
[R]
📄 add_library.rst
[E]
[D]
[R]
📄 add_library.rst.rename
[E]
[D]
[R]
📄 add_link_options.rst
[E]
[D]
[R]
📄 add_link_options.rst.rename
[E]
[D]
[R]
📄 add_subdirectory.rst
[E]
[D]
[R]
📄 add_test.rst
[E]
[D]
[R]
📄 add_test.rst.rename
[E]
[D]
[R]
📄 aux_source_directory.rst
[E]
[D]
[R]
📄 break.rst
[E]
[D]
[R]
📄 build_command.rst
[E]
[D]
[R]
📄 build_command.rst.rename
[E]
[D]
[R]
📄 build_name.rst
[E]
[D]
[R]
📄 cmake_host_system_information.rst
[E]
[D]
[R]
📄 cmake_minimum_required.rst
[E]
[D]
[R]
📄 cmake_parse_arguments.rst
[E]
[D]
[R]
📄 cmake_policy.rst
[E]
[D]
[R]
📄 cmake_policy.rst.rename
[E]
[D]
[R]
📄 configure_file.rst
[E]
[D]
[R]
📄 continue.rst
[E]
[D]
[R]
📄 create_test_sourcelist.rst
[E]
[D]
[R]
📄 ctest_build.rst
[E]
[D]
[R]
📄 ctest_build.rst.rename
[E]
[D]
[R]
📄 ctest_configure.rst
[E]
[D]
[R]
📄 ctest_coverage.rst
[E]
[D]
[R]
📄 ctest_empty_binary_directory.rst
[E]
[D]
[R]
📄 ctest_memcheck.rst
[E]
[D]
[R]
📄 ctest_read_custom_files.rst
[E]
[D]
[R]
📄 ctest_read_custom_files.rst.rename
[E]
[D]
[R]
📄 ctest_run_script.rst
[E]
[D]
[R]
📄 ctest_sleep.rst
[E]
[D]
[R]
📄 ctest_start.rst
[E]
[D]
[R]
📄 ctest_submit.rst
[E]
[D]
[R]
📄 ctest_test.rst
[E]
[D]
[R]
📄 ctest_test.rst.rename
[E]
[D]
[R]
📄 ctest_update.rst
[E]
[D]
[R]
📄 ctest_upload.rst
[E]
[D]
[R]
📄 define_property.rst
[E]
[D]
[R]
📄 else.rst
[E]
[D]
[R]
📄 elseif.rst
[E]
[D]
[R]
📄 enable_language.rst
[E]
[D]
[R]
📄 enable_testing.rst
[E]
[D]
[R]
📄 endforeach.rst
[E]
[D]
[R]
📄 endfunction.rst
[E]
[D]
[R]
📄 endif.rst
[E]
[D]
[R]
📄 endmacro.rst
[E]
[D]
[R]
📄 endwhile.rst
[E]
[D]
[R]
📄 exec_program.rst
[E]
[D]
[R]
📄 execute_process.rst
[E]
[D]
[R]
📄 export.rst
[E]
[D]
[R]
📄 export_library_dependencies.rst
[E]
[D]
[R]
📄 file.rst
[E]
[D]
[R]
📄 file.rst.rename
[E]
[D]
[R]
📄 find_file.rst
[E]
[D]
[R]
📄 find_library.rst
[E]
[D]
[R]
📄 find_package.rst
[E]
[D]
[R]
📄 find_package.rst.rename
[E]
[D]
[R]
📄 find_path.rst
[E]
[D]
[R]
📄 find_program.rst
[E]
[D]
[R]
📄 fltk_wrap_ui.rst
[E]
[D]
[R]
📄 foreach.rst
[E]
[D]
[R]
📄 function.rst
[E]
[D]
[R]
📄 get_cmake_property.rst
[E]
[D]
[R]
📄 get_cmake_property.rst.rename
[E]
[D]
[R]
📄 get_directory_property.rst
[E]
[D]
[R]
📄 get_filename_component.rst
[E]
[D]
[R]
📄 get_property.rst
[E]
[D]
[R]
📄 get_source_file_property.rst
[E]
[D]
[R]
📄 get_target_property.rst
[E]
[D]
[R]
📄 get_test_property.rst
[E]
[D]
[R]
📄 if.rst
[E]
[D]
[R]
📄 include.rst
[E]
[D]
[R]
📄 include_directories.rst
[E]
[D]
[R]
📄 include_directories.rst.rename
[E]
[D]
[R]
📄 include_external_msproject.rst
[E]
[D]
[R]
📄 include_guard.rst
[E]
[D]
[R]
📄 include_regular_expression.rst
[E]
[D]
[R]
📄 install.rst
[E]
[D]
[R]
📄 install.rst.rename
[E]
[D]
[R]
📄 install_files.rst
[E]
[D]
[R]
📄 install_programs.rst
[E]
[D]
[R]
📄 install_targets.rst
[E]
[D]
[R]
📄 link_directories.rst
[E]
[D]
[R]
📄 link_directories.rst.rename
[E]
[D]
[R]
📄 link_libraries.rst
[E]
[D]
[R]
📄 list.rst
[E]
[D]
[R]
📄 list.rst.rename
[E]
[D]
[R]
📄 load_cache.rst
[E]
[D]
[R]
📄 load_command.rst
[E]
[D]
[R]
📄 macro.rst
[E]
[D]
[R]
📄 make_directory.rst
[E]
[D]
[R]
📄 mark_as_advanced.rst
[E]
[D]
[R]
📄 math.rst
[E]
[D]
[R]
📄 message.rst
[E]
[D]
[R]
📄 option.rst
[E]
[D]
[R]
📄 output_required_files.rst
[E]
[D]
[R]
📄 project.rst
[E]
[D]
[R]
📄 qt_wrap_cpp.rst
[E]
[D]
[R]
📄 qt_wrap_ui.rst
[E]
[D]
[R]
📄 remove.rst
[E]
[D]
[R]
📄 remove_definitions.rst
[E]
[D]
[R]
📄 return.rst
[E]
[D]
[R]
📄 separate_arguments.rst
[E]
[D]
[R]
📄 set.rst
[E]
[D]
[R]
📄 set.rst.rename
[E]
[D]
[R]
📄 set_directory_properties.rst
[E]
[D]
[R]
📄 set_property.rst
[E]
[D]
[R]
📄 set_property.rst.rename
[E]
[D]
[R]
📄 set_source_files_properties.rst
[E]
[D]
[R]
📄 set_target_properties.rst
[E]
[D]
[R]
📄 set_tests_properties.rst
[E]
[D]
[R]
📄 set_tests_properties.rst.rename
[E]
[D]
[R]
📄 site_name.rst
[E]
[D]
[R]
📄 source_group.rst
[E]
[D]
[R]
📄 string.rst
[E]
[D]
[R]
📄 string.rst.rename
[E]
[D]
[R]
📄 subdir_depends.rst
[E]
[D]
[R]
📄 subdirs.rst
[E]
[D]
[R]
📄 target_compile_definitions.rst
[E]
[D]
[R]
📄 target_compile_definitions.rst.rename
[E]
[D]
[R]
📄 target_compile_features.rst
[E]
[D]
[R]
📄 target_compile_features.rst.rename
[E]
[D]
[R]
📄 target_compile_options.rst
[E]
[D]
[R]
📄 target_compile_options.rst.rename
[E]
[D]
[R]
📄 target_include_directories.rst
[E]
[D]
[R]
📄 target_include_directories.rst.rename
[E]
[D]
[R]
📄 target_link_directories.rst
[E]
[D]
[R]
📄 target_link_directories.rst.rename
[E]
[D]
[R]
📄 target_link_libraries.rst
[E]
[D]
[R]
📄 target_link_libraries.rst.rename
[E]
[D]
[R]
📄 target_link_options.rst
[E]
[D]
[R]
📄 target_link_options.rst.rename
[E]
[D]
[R]
📄 target_precompile_headers.rst
[E]
[D]
[R]
📄 target_sources.rst
[E]
[D]
[R]
📄 target_sources.rst.rename
[E]
[D]
[R]
📄 try_compile.rst
[E]
[D]
[R]
📄 try_compile.rst.rename
[E]
[D]
[R]
📄 try_run.rst
[E]
[D]
[R]
📄 try_run.rst.rename
[E]
[D]
[R]
📄 unset.rst
[E]
[D]
[R]
📄 unset.rst.rename
[E]
[D]
[R]
📄 use_mangled_mesa.rst
[E]
[D]
[R]
📄 utility_source.rst
[E]
[D]
[R]
📄 variable_requires.rst
[E]
[D]
[R]
📄 variable_watch.rst
[E]
[D]
[R]
📄 while.rst
[E]
[D]
[R]
📄 write_file.rst
[E]
[D]
[R]
Editing: macro.rst
macro ----- Start recording a macro for later invocation as a command .. code-block:: cmake macro(<name> [<arg1> ...]) <commands> endmacro() Defines a macro named ``<name>`` that takes arguments named ``<arg1>``, ... Commands listed after macro, but before the matching :command:`endmacro()`, are not executed until the macro is invoked. Per legacy, the :command:`endmacro` command admits an optional ``<name>`` argument. If used, it must be a verbatim repeat of the argument of the opening ``macro`` command. See the :command:`cmake_policy()` command documentation for the behavior of policies inside macros. See the :ref:`Macro vs Function` section below for differences between CMake macros and :command:`functions <function>`. Invocation ^^^^^^^^^^ The macro invocation is case-insensitive. A macro defined as .. code-block:: cmake macro(foo) <commands> endmacro() can be invoked through any of .. code-block:: cmake foo() Foo() FOO() and so on. However, it is strongly recommended to stay with the case chosen in the macro definition. Typically macros use all-lowercase names. Arguments ^^^^^^^^^ When a macro is invoked, the commands recorded in the macro are first modified by replacing formal parameters (``${arg1}``, ...) with the arguments passed, and then invoked as normal commands. In addition to referencing the formal parameters you can reference the values ``${ARGC}`` which will be set to the number of arguments passed into the function as well as ``${ARGV0}``, ``${ARGV1}``, ``${ARGV2}``, ... which will have the actual values of the arguments passed in. This facilitates creating macros with optional arguments. Furthermore, ``${ARGV}`` holds the list of all arguments given to the macro and ``${ARGN}`` holds the list of arguments past the last expected argument. Referencing to ``${ARGV#}`` arguments beyond ``${ARGC}`` have undefined behavior. Checking that ``${ARGC}`` is greater than ``#`` is the only way to ensure that ``${ARGV#}`` was passed to the function as an extra argument. .. _`Macro vs Function`: Macro vs Function ^^^^^^^^^^^^^^^^^ The ``macro`` command is very similar to the :command:`function` command. Nonetheless, there are a few important differences. In a function, ``ARGN``, ``ARGC``, ``ARGV`` and ``ARGV0``, ``ARGV1``, ... are true variables in the usual CMake sense. In a macro, they are not, they are string replacements much like the C preprocessor would do with a macro. This has a number of consequences, as explained in the :ref:`Argument Caveats` section below. Another difference between macros and functions is the control flow. A function is executed by transferring control from the calling statement to the function body. A macro is executed as if the macro body were pasted in place of the calling statement. This has the consequence that a :command:`return()` in a macro body does not just terminate execution of the macro; rather, control is returned from the scope of the macro call. To avoid confusion, it is recommended to avoid :command:`return()` in macros altogether. Unlike a function, the :variable:`CMAKE_CURRENT_FUNCTION`, :variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR`, :variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE`, :variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` variables are not set for a macro. .. _`Argument Caveats`: Argument Caveats ^^^^^^^^^^^^^^^^ Since ``ARGN``, ``ARGC``, ``ARGV``, ``ARGV0`` etc. are not variables, you will NOT be able to use commands like .. code-block:: cmake if(ARGV1) # ARGV1 is not a variable if(DEFINED ARGV2) # ARGV2 is not a variable if(ARGC GREATER 2) # ARGC is not a variable foreach(loop_var IN LISTS ARGN) # ARGN is not a variable In the first case, you can use ``if(${ARGV1})``. In the second and third case, the proper way to check if an optional variable was passed to the macro is to use ``if(${ARGC} GREATER 2)``. In the last case, you can use ``foreach(loop_var ${ARGN})`` but this will skip empty arguments. If you need to include them, you can use .. code-block:: cmake set(list_var "${ARGN}") foreach(loop_var IN LISTS list_var) Note that if you have a variable with the same name in the scope from which the macro is called, using unreferenced names will use the existing variable instead of the arguments. For example: .. code-block:: cmake macro(bar) foreach(arg IN LISTS ARGN) <commands> endforeach() endmacro() function(foo) bar(x y z) endfunction() foo(a b c) Will loop over ``a;b;c`` and not over ``x;y;z`` as one might have expected. If you want true CMake variables and/or better CMake scope control you should look at the function command.
Save