본문 바로가기
Linux

MAKE && CMAKE 주요 옵션들

by Yoon_estar 2024. 4. 22.
728x90
반응형

MAKE && CMAKE 주요 옵션들

cmake 주요 옵션

# cmake --help
Usage

  cmake [options]
  cmake [options]
  cmake [options] -S  -B

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           = Explicitly specify a source directory.
  -B            = Explicitly specify a build directory.
  -C            = Pre-load a script to populate the cache.
  -D[:]=    = Create or update a cmake cache entry.
  -U            = Remove matching entries from CMake cache.
  -G           = Specify a build system generator.
  -T             = Specify toolset name if supported by
                                 generator.
  -A            = Specify platform name if supported by
                                 generator.
  --toolchain            = Specify toolchain file
                                 [CMAKE_TOOLCHAIN_FILE].
  --install-prefix  = Specify install directory
                                 [CMAKE_INSTALL_PREFIX].
  -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.
  --preset ,--preset=
                               = Specify a configure preset.
  --list-presets[=]      = List available presets.
  -E                           = CMake command mode.
  -L[A][H]                     = List non-advanced cached variables.
  --fresh                      = Configure a fresh build tree, removing any
                                 existing cache file.
  --build                = Build a CMake-generated project binary tree.
  --install              = Install a CMake-generated project binary
                                 tree.
  --open                 = Open generated project in the associated
                                 application.
  -N                           = View mode only.
  -P                     = Process script mode.
  --find-package               = Legacy pkg-config like mode.  Do not use.
  --graphviz=            = Generate graphviz of dependencies, see
                                 CMakeGraphVizOptions.cmake for more.
  --system-information [file]  = Dump information about this system.
  --log-level=
                               = Set the verbosity of messages from CMake
                                 files.  --loglevel is also accepted for
                                 backward compatibility reasons.
  --log-context                = Prepend log messages with context, if given
  --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.
  --debug-find                 = Put cmake find in a debug mode.
  --debug-find-pkg=[,...]
                               = Limit cmake debug-find to the
                                 comma-separated list of packages
  --debug-find-var=[,...]
                               = Limit cmake debug-find to the
                                 comma-separated list of result variables
  --trace                      = Put cmake in trace mode.
  --trace-expand               = Put cmake in trace mode with variable
                                 expansion.
  --trace-format=
                               = Set the output format of the trace.
  --trace-source=        = Trace only this CMake file/module.  Multiple
                                 options allowed.
  --trace-redirect=      = Redirect trace output to a file instead of
                                 stderr.
  --warn-uninitialized         = Warn about uninitialized values.
  --no-warn-unused-cli         = Don't warn about command line options.
  --check-system-vars          = Find problems with variable usage in system
                                 files.
  --compile-no-warning-as-error= Ignore COMPILE_WARNING_AS_ERROR property and
                                 CMAKE_COMPILE_WARNING_AS_ERROR variable.
  --profiling-format=     = Output data for profiling CMake scripts.
                                 Supported formats: google-trace
  --profiling-output=    = Select an output path for the profiling data
                                 enabled through --profiling-format.
  -h,-H,--help,-help,-usage,/? = Print usage information and exit.
  --version,-version,/V []
                               = Print version number and exit.
  --help-full []         = Print all help manuals and exit.
  --help-manual  [] = Print one help manual and exit.
  --help-manual-list []  = List help manuals available and exit.
  --help-command  []= Print help for one command and exit.
  --help-command-list [] = List commands with help available and exit.
  --help-commands []     = Print cmake-commands manual and exit.
  --help-module  [] = Print help for one module and exit.
  --help-module-list []  = List modules with help available and exit.
  --help-modules []      = Print cmake-modules manual and exit.
  --help-policy  [] = Print help for one policy and exit.
  --help-policy-list []  = List policies with help available and exit.
  --help-policies []     = Print cmake-policies manual and exit.
  --help-property  []
                               = Print help for one property and exit.
  --help-property-list []= List properties with help available and
                                 exit.
  --help-properties []   = Print cmake-properties manual and exit.
  --help-variable var [] = Print help for one variable and exit.
  --help-variable-list []= List variables with help available and exit.
  --help-variables []    = Print cmake-variables manual and exit.

Generators

The following generators are available on this platform (* marks default):
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
* Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Ninja Multi-Config           = 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.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.

-G <genrator-name>

  • 프로젝트를 위한 빌드 시스템을 생성할 때 사용할 생성기(generator)를 지정합니다. 예를 들어, Unix Makefiles, Ninja, Visual Studio 등이 있습니다.
 -G           = Specify a build system generator.

--build <dir>

  • 지정된 빌드 디렉토리에서 실제 빌드 프로세스를 시작합니다. cmake --build . 명령은 현재 디렉토리에서 빌드를 수행합니다.
 --build                = Build a CMake-generated project binary tree.

-L[A][H]

  • CMake 프로젝트의 모든 옵션과 그 값들을 리스트로 출력합니다. **-LA**는 고급 옵션을 포함하여 출력하고, **-LAH**는 내부적으로 사용되는 옵션까지 포함하여 출력합니다.
-L[A][H]                     = List non-advanced cached variables.

 

Make 주요 옵션

[root@master ~]# make --help
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  --eval=STRING               Evaluate STRING as a makefile statement.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from recipes.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any recipe; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -O[TYPE], --output-sync[=TYPE]
                              Synchronize output of parallel jobs by TYPE.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no recipe; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo recipes.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  --trace                     Print tracing information.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.

This program built for x86_64-redhat-linux-gnu
Report bugs to

-f <file>

  • 사용한 Makefile을 지정합니다. 기본 값은 현재 디렉토리의 Makefile 입니다.
 -f FILE, --file=FILE, --makefile=FILE

-j <jobs>

  • 동시에 수행할 작업(컴파일)의 수를 지정합니다. 예를 들어 -j4는 동시에 네개의 작업을 수행합니다.
 -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.

-n

  • 실제로 빌드를 수행하지 않고 수행될 작업을 출력합니다.
 -n, --just-print, --dry-run, --recon
                              Don't actually run any recipe; just print them.

-C <dir>

  • 지정된 디렉토리로 이동한 다음 **make**를 실행합니다.
-C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
반응형