最終更新:2021-03-09 (火) 07:45:09 (1144d)  

cmake
Top / cmake

Cross-Platform Makefile Generator.

Usage

  • cmake [options] <path-to-source>
    cmake [options] <path-to-existing-build>

引数を渡す

  • Create a cmake cache entry.
    cmake -D変数名=値

デバッグモード

コマンドライン

  • # cmake 
    # make

オプション

インタラクティブモード

  • cmake -i? : インタラクティブにオプションを指定 (no longer supported - たぶんCMake 3.0?で削除)
    The "cmake -i" wizard mode is no longer supported.
    Use the -D option to set cache values on the command line.
    Use cmake-gui or ccmake for an interactive dialog.
  • 代替

help

CMake 3.16.3?

  • Ubuntu 20.04
    Usage
    
      cmake [options] <path-to-source>
      cmake [options] <path-to-existing-build>
      cmake [options] -S <path-to-source> -B <path-to-build>
    
    Specify a source directory to (re-)generate a build system for it in the
    current working directory.  Specify an existing build directory to
    re-generate its build system.
    
    Options
      -S <path-to-source>          = Explicitly specify a source directory.
      -B <path-to-build>           = Explicitly specify a build directory.
      -C <initial-cache>           = Pre-load a script to populate the cache.
      -D <var>[:<type>]=<value>    = Create or update a cmake cache entry.
      -U <globbing_expr>           = Remove matching entries from CMake cache.
      -G <generator-name>          = Specify a build system generator.
      -T <toolset-name>            = Specify toolset name if supported by
                                     generator.
      -A <platform-name>           = Specify platform name if supported by
                                     generator.
      -Wdev                        = Enable developer warnings.
      -Wno-dev                     = Suppress developer warnings.
      -Werror=dev                  = Make developer warnings errors.
      -Wno-error=dev               = Make developer warnings not errors.
      -Wdeprecated                 = Enable deprecation warnings.
      -Wno-deprecated              = Suppress deprecation warnings.
      -Werror=deprecated           = Make deprecated macro and function warnings
                                     errors.
      -Wno-error=deprecated        = Make deprecated macro and function warnings
                                     not errors.
      -E                           = CMake command mode.
      -L[A][H]                     = List non-advanced cached variables.
      --build <dir>                = Build a CMake-generated project binary tree.
      --install <dir>              = Install a CMake-generated project binary
                                     tree.
      --open <dir>                 = Open generated project in the associated
                                     application.
      -N                           = View mode only.
      -P <file>                    = Process script mode.
      --find-package               = Run in pkg-config like mode.
      --graphviz=[file]            = Generate graphviz of dependencies, see
                                     CMakeGraphVizOptions.cmake for more.
      --system-information [file]  = Dump information about this system.
      --log-level=<ERROR|WARNING|NOTICE|STATUS|VERBOSE|DEBUG|TRACE>
                                   = Set the verbosity of messages from CMake
                                     files.  --loglevel is also accepted for
                                     backward compatibility reasons.
      --debug-trycompile           = Do not delete the try_compile build tree.
                                     Only useful on one try_compile at a time.
      --debug-output               = Put cmake in a debug mode.
      --trace                      = Put cmake in trace mode.
      --trace-expand               = Put cmake in trace mode with variable
                                     expansion.
      --trace-source=<file>        = Trace only this CMake file/module.  Multiple
                                     options allowed.
      --trace-redirect=<file>      = Redirect trace output to a file instead of
                                     stderr.
      --warn-uninitialized         = Warn about uninitialized values.
      --warn-unused-vars           = Warn about unused variables.
      --no-warn-unused-cli         = Don't warn about command line options.
      --check-system-vars          = Find problems with variable usage in system
                                     files.
      --help,-help,-usage,-h,-H,/? = Print usage information and exit.
      --version,-version,/V [<f>]  = Print version number and exit.
      --help-full [<f>]            = Print all help manuals and exit.
      --help-manual <man> [<f>]    = Print one help manual and exit.
      --help-manual-list [<f>]     = List help manuals available and exit.
      --help-command <cmd> [<f>]   = Print help for one command and exit.
      --help-command-list [<f>]    = List commands with help available and exit.
      --help-commands [<f>]        = Print cmake-commands manual and exit.
      --help-module <mod> [<f>]    = Print help for one module and exit.
      --help-module-list [<f>]     = List modules with help available and exit.
      --help-modules [<f>]         = Print cmake-modules manual and exit.
      --help-policy <cmp> [<f>]    = Print help for one policy and exit.
      --help-policy-list [<f>]     = List policies with help available and exit.
      --help-policies [<f>]        = Print cmake-policies manual and exit.
      --help-property <prop> [<f>] = Print help for one property and exit.
      --help-property-list [<f>]   = List properties with help available and
                                     exit.
      --help-properties [<f>]      = Print cmake-properties manual and exit.
      --help-variable var [<f>]    = Print help for one variable and exit.
      --help-variable-list [<f>]   = List variables with help available and exit.
      --help-variables [<f>]       = Print cmake-variables manual and exit.
    
    Generators
    
    The following generators are available on this platform (* marks default):
    * Unix Makefiles               = Generates standard UNIX makefiles.
      Green Hills MULTI            = Generates Green Hills MULTI files
                                     (experimental, work-in-progress).
      Ninja                        = Generates build.ninja files.
      Watcom WMake                 = Generates Watcom WMake makefiles.
      CodeBlocks - Ninja           = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
      CodeLite - Ninja             = Generates CodeLite project files.
      CodeLite - Unix Makefiles    = Generates CodeLite project files.
      Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
      Sublime Text 2 - Unix Makefiles
                                   = Generates Sublime Text 2 project files.
      Kate - Ninja                 = Generates Kate project files.
      Kate - Unix Makefiles        = Generates Kate project files.
      Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
    

CMake 3.10.2?

  • Ubuntu 18.04
    cmake --help
    Usage
    
      cmake [options] <path-to-source>
      cmake [options] <path-to-existing-build>
    
    Specify a source directory to (re-)generate a build system for it in the
    current working directory.  Specify an existing build directory to
    re-generate its build system.
    
    Options
      -C <initial-cache>           = Pre-load a script to populate the cache.
      -D <var>[:<type>]=<value>    = Create a cmake cache entry.
      -U <globbing_expr>           = Remove matching entries from CMake cache.
      -G <generator-name>          = Specify a build system generator.
      -T <toolset-name>            = Specify toolset name if supported by
                                     generator.
      -A <platform-name>           = Specify platform name if supported by
                                     generator.
      -Wdev                        = Enable developer warnings.
      -Wno-dev                     = Suppress developer warnings.
      -Werror=dev                  = Make developer warnings errors.
      -Wno-error=dev               = Make developer warnings not errors.
      -Wdeprecated                 = Enable deprecation warnings.
      -Wno-deprecated              = Suppress deprecation warnings.
      -Werror=deprecated           = Make deprecated macro and function warnings
                                     errors.
      -Wno-error=deprecated        = Make deprecated macro and function warnings
                                     not errors.
      -E                           = CMake command mode.
      -L[A][H]                     = List non-advanced cached variables.
      --build <dir>                = Build a CMake-generated project binary tree.
      -N                           = View mode only.
      -P <file>                    = Process script mode.
      --find-package               = Run in pkg-config like mode.
      --graphviz=[file]            = Generate graphviz of dependencies, see
                                     CMakeGraphVizOptions.cmake for more.
      --system-information [file]  = Dump information about this system.
      --debug-trycompile           = Do not delete the try_compile build tree.
                                     Only useful on one try_compile at a time.
      --debug-output               = Put cmake in a debug mode.
      --trace                      = Put cmake in trace mode.
      --trace-expand               = Put cmake in trace mode with variable
                                     expansion.
      --trace-source=<file>        = Trace only this CMake file/module.  Multiple
                                     options allowed.
      --warn-uninitialized         = Warn about uninitialized values.
      --warn-unused-vars           = Warn about unused variables.
      --no-warn-unused-cli         = Don't warn about command line options.
      --check-system-vars          = Find problems with variable usage in system
                                     files.
      --help,-help,-usage,-h,-H,/? = Print usage information and exit.
      --version,-version,/V [<f>]  = Print version number and exit.
      --help-full [<f>]            = Print all help manuals and exit.
      --help-manual <man> [<f>]    = Print one help manual and exit.
      --help-manual-list [<f>]     = List help manuals available and exit.
      --help-command <cmd> [<f>]   = Print help for one command and exit.
      --help-command-list [<f>]    = List commands with help available and exit.
      --help-commands [<f>]        = Print cmake-commands manual and exit.
      --help-module <mod> [<f>]    = Print help for one module and exit.
      --help-module-list [<f>]     = List modules with help available and exit.
      --help-modules [<f>]         = Print cmake-modules manual and exit.
      --help-policy <cmp> [<f>]    = Print help for one policy and exit.
      --help-policy-list [<f>]     = List policies with help available and exit.
      --help-policies [<f>]        = Print cmake-policies manual and exit.
      --help-property <prop> [<f>] = Print help for one property and exit.
      --help-property-list [<f>]   = List properties with help available and
                                     exit.
      --help-properties [<f>]      = Print cmake-properties manual and exit.
      --help-variable var [<f>]    = Print help for one variable and exit.
      --help-variable-list [<f>]   = List variables with help available and exit.
      --help-variables [<f>]       = Print cmake-variables manual and exit.
    
    Generators
    
    The following generators are available on this platform:
      Unix Makefiles               = Generates standard UNIX makefiles.
      Ninja                        = Generates build.ninja files.
      Watcom WMake                 = Generates Watcom WMake makefiles.
      CodeBlocks - Ninja           = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
      CodeLite - Ninja             = Generates CodeLite project files.
      CodeLite - Unix Makefiles    = Generates CodeLite project files.
      Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
      Sublime Text 2 - Unix Makefiles
                                   = Generates Sublime Text 2 project files.
      Kate - Ninja                 = Generates Kate project files.
      Kate - Unix Makefiles        = Generates Kate project files.
      Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
      KDevelop3                    = Generates KDevelop 3 project files.
      KDevelop3 - Unix Makefiles   = Generates KDevelop 3 project files.
    

公式Win32

3.3.2

  • cmake-3.3.2-win32-x86\bin>cmake --help
    Usage
    
      cmake [options] <path-to-source>
      cmake [options] <path-to-existing-build>
    
    Specify a source directory to (re-)generate a build system for it in the
    current working directory.  Specify an existing build directory to
    re-generate its build system.
    
    Options
      -C <initial-cache>           = Pre-load a script to populate the cache.
      -D <var>[:<type>]=<value>    = Create a cmake cache entry.
      -U <globbing_expr>           = Remove matching entries from CMake cache.
      -G <generator-name>          = Specify a build system generator.
      -T <toolset-name>            = Specify toolset name if supported by
                                     generator.
      -A <platform-name>           = Specify platform name if supported by
                                     generator.
      -Wno-dev                     = Suppress developer warnings.
      -Wdev                        = Enable developer warnings.
      -E                           = CMake command mode.
      -L[A][H]                     = List non-advanced cached variables.
      --build <dir>                = Build a CMake-generated project binary tree.
      -N                           = View mode only.
      -P <file>                    = Process script mode.
      --find-package               = Run in pkg-config like mode.
      --graphviz=[file]            = Generate graphviz of dependencies, see
                                     CMakeGraphVizOptions.cmake for more.
      --system-information [file]  = Dump information about this system.
      --debug-trycompile           = Do not delete the try_compile build tree.
                                     Only useful on one try_compile at a time.
      --debug-output               = Put cmake in a debug mode.
      --trace                      = Put cmake in trace mode.
      --warn-uninitialized         = Warn about uninitialized values.
      --warn-unused-vars           = Warn about unused variables.
      --no-warn-unused-cli         = Don't warn about command line options.
      --check-system-vars          = Find problems with variable usage in system
                                     files.
      --help,-help,-usage,-h,-H,/? = Print usage information and exit.
      --version,-version,/V [<f>]  = Print version number and exit.
      --help-full [<f>]            = Print all help manuals and exit.
      --help-manual <man> [<f>]    = Print one help manual and exit.
      --help-manual-list [<f>]     = List help manuals available and exit.
      --help-command <cmd> [<f>]   = Print help for one command and exit.
      --help-command-list [<f>]    = List commands with help available and exit.
      --help-commands [<f>]        = Print cmake-commands manual and exit.
      --help-module <mod> [<f>]    = Print help for one module and exit.
      --help-module-list [<f>]     = List modules with help available and exit.
      --help-modules [<f>]         = Print cmake-modules manual and exit.
      --help-policy <cmp> [<f>]    = Print help for one policy and exit.
      --help-policy-list [<f>]     = List policies with help available and exit.
      --help-policies [<f>]        = Print cmake-policies manual and exit.
      --help-property <prop> [<f>] = Print help for one property and exit.
      --help-property-list [<f>]   = List properties with help available and
                                     exit.
      --help-properties [<f>]      = Print cmake-properties manual and exit.
      --help-variable var [<f>]    = Print help for one variable and exit.
      --help-variable-list [<f>]   = List variables with help available and exit.
      --help-variables [<f>]       = Print cmake-variables manual and exit.
    
    Generators
    
    The following generators are available on this platform:
      Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                     Optional [arch] can be "Win64" or "ARM".
      Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                     Optional [arch] can be "Win64" or "ARM".
      Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                     Optional [arch] can be "Win64" or "ARM".
      Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                     Optional [arch] can be "Win64" or "IA64".
      Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                     Optional [arch] can be "Win64" or "IA64".
      Visual Studio 8 2005 [arch]  = Generates Visual Studio 2005 project files.
                                     Optional [arch] can be "Win64".
      Visual Studio 7 .NET 2003    = Generates Visual Studio .NET 2003 project
                                     files.
      Visual Studio 7              = Deprecated.  Generates Visual Studio .NET
                                     2002 project files.
      Visual Studio 6              = Deprecated.  Generates Visual Studio 6
                                     project files.
      Borland Makefiles            = Generates Borland makefiles.
      NMake Makefiles              = Generates NMake makefiles.
      NMake Makefiles JOM          = Generates JOM makefiles.
      Green Hills MULTI            = Generates Green Hills MULTI files
                                     (experimental, work-in-progress).
      MSYS Makefiles               = Generates MSYS makefiles.
      MinGW Makefiles              = Generates a make file for use with
                                     mingw32-make.
      Unix Makefiles               = Generates standard UNIX makefiles.
      Ninja                        = Generates build.ninja files.
      Watcom WMake                 = Generates Watcom WMake makefiles.
      CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
      CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
      CodeBlocks - Ninja           = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
      CodeLite - MinGW Makefiles   = Generates CodeLite project files.
      CodeLite - NMake Makefiles   = Generates CodeLite project files.
      CodeLite - Ninja             = Generates CodeLite project files.
      CodeLite - Unix Makefiles    = Generates CodeLite project files.
      Eclipse CDT4 - MinGW Makefiles
                                   = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - NMake Makefiles
                                   = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
      Kate - MinGW Makefiles       = Generates Kate project files.
      Kate - NMake Makefiles       = Generates Kate project files.
      Kate - Ninja                 = Generates Kate project files.
      Kate - Unix Makefiles        = Generates Kate project files.
      Sublime Text 2 - MinGW Makefiles
                                   = Generates Sublime Text 2 project files.
      Sublime Text 2 - NMake Makefiles
                                   = Generates Sublime Text 2 project files.
      Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
      Sublime Text 2 - Unix Makefiles
                                   = Generates Sublime Text 2 project files.
    

2.8

  • cmake version 2.8.10.2
    Usage
    
      cmake [options] <path-to-source>
      cmake [options] <path-to-existing-build>
    
    Options
      -C <initial-cache>          = Pre-load a script to populate the cache.
      -D <var>:<type>=<value>     = Create a cmake cache entry.
      -U <globbing_expr>          = Remove matching entries from CMake cache.
      -G <generator-name>         = Specify a makefile generator.
      -Wno-dev                    = Suppress developer warnings.
      -Wdev                       = Enable developer warnings.
      -E                          = CMake command mode.
      -i                          = Run in wizard mode.
      -L[A][H]                    = List non-advanced cached variables.
      --build <dir>               = Build a CMake-generated project binary tree.
      -N                          = View mode only.
      -P <file>                   = Process script mode.
      --find-package              = Run in pkg-config like mode.
      --graphviz=[file]           = Generate graphviz of dependencies.
      --system-information [file] = Dump information about this system.
      --debug-trycompile          = Do not delete the try_compile build tree.
                                    Only useful on one try_compile at a time.
      --debug-output              = Put cmake in a debug mode.
      --trace                     = Put cmake in trace mode.
      --warn-uninitialized        = Warn about uninitialized values.
      --warn-unused-vars          = Warn about unused variables.
      --no-warn-unused-cli        = Don't warn about command line options.
      --check-system-vars         = Find problems with variable usage in system
                                    files.
      --help-command cmd [file]   = Print help for a single command and exit.
      --help-command-list [file]  = List available listfile commands and exit.
      --help-commands [file]      = Print help for all commands and exit.
      --help-compatcommands [file]= Print help for compatibility commands.
      --help-module module [file] = Print help for a single module and exit.
      --help-module-list [file]   = List available modules and exit.
      --help-modules [file]       = Print help for all modules and exit.
      --help-custom-modules [file]= Print help for all custom modules and exit.
      --help-policy cmp [file]    = Print help for a single policy and exit.
      --help-policies [file]      = Print help for all policies and exit.
      --help-property prop [file] = Print help for a single property and exit.
      --help-property-list [file] = List available properties and exit.
      --help-properties [file]    = Print help for all properties and exit.
      --help-variable var [file]  = Print help for a single variable and exit.
      --help-variable-list [file] = List documented variables and exit.
      --help-variables [file]     = Print help for all variables and exit.
      --copyright [file]          = Print the CMake copyright and exit.
      --help,-help,-usage,-h,-H,/?= Print usage information and exit.
      --help-full [file]          = Print full help and exit.
      --help-html [file]          = Print full help in HTML format.
      --help-man [file]           = Print full help as a UNIX man page and exit.
      --version,-version,/V [file]= Show program name/version banner and exit.
    
    Generators
    
    The following generators are available on this platform:
      Borland Makefiles           = Generates Borland makefiles.
      MSYS Makefiles              = Generates MSYS makefiles.
      MinGW Makefiles             = Generates a make file for use with
                                    mingw32-make.
      NMake Makefiles             = Generates NMake makefiles.
      NMake Makefiles JOM         = Generates JOM makefiles.
      Ninja                       = Generates build.ninja files (experimental).
      Unix Makefiles              = Generates standard UNIX makefiles.
      Visual Studio 10            = Generates Visual Studio 10 project files.
      Visual Studio 10 IA64       = Generates Visual Studio 10 Itanium project
                                    files.
      Visual Studio 10 Win64      = Generates Visual Studio 10 Win64 project
                                    files.
      Visual Studio 11            = Generates Visual Studio 11 project files.
      Visual Studio 11 ARM        = Generates Visual Studio 11 ARM project files.
      Visual Studio 11 Win64      = Generates Visual Studio 11 Win64 project
                                    files.
      Visual Studio 6             = Generates Visual Studio 6 project files.
      Visual Studio 7             = Generates Visual Studio .NET 2002 project
                                    files.
      Visual Studio 7 .NET 2003   = Generates Visual Studio .NET 2003 project
                                    files.
      Visual Studio 8 2005        = Generates Visual Studio 8 2005 project files.
      Visual Studio 8 2005 Win64  = Generates Visual Studio 8 2005 Win64 project
                                    files.
      Visual Studio 9 2008        = Generates Visual Studio 9 2008 project files.
      Visual Studio 9 2008 IA64   = Generates Visual Studio 9 2008 Itanium
                                    project files.
      Visual Studio 9 2008 Win64  = Generates Visual Studio 9 2008 Win64 project
                                    files.
      Watcom WMake                = Generates Watcom WMake makefiles.
      CodeBlocks - MinGW Makefiles= Generates CodeBlocks project files.
      CodeBlocks - NMake Makefiles= Generates CodeBlocks project files.
      CodeBlocks - Ninja          = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
      Eclipse CDT4 - MinGW Makefiles
                                  = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - NMake Makefiles
                                  = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles
                                  = Generates Eclipse CDT 4.0 project files.

Cygwinのやつ

  • cmake version 2.8.9
    
    ...
    
    Generators
    
    The following generators are available on this platform:
      Ninja                       = Generates build.ninja files (experimental).
      Unix Makefiles              = Generates standard UNIX makefiles.
      CodeBlocks - Ninja          = Generates CodeBlocks project files.
      CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
      Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.
      Eclipse CDT4 - Unix Makefiles
                                  = Generates Eclipse CDT 4.0 project files.
      KDevelop3                   = Generates KDevelop 3 project files.
      KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.
    

Ubuntu/パッケージ

コマンド