티스토리 뷰

OS/UnixLinux

Linux에 cmake 설치하기

negafix 2011. 4. 21. 10:01


cmake 는 크로스 플랫폼을 지원 합니다. 게다가 오픈소스이기도 하구요.

얼마전 Linux 서버에 MySQL 5.5 버전을 설치하려고 살펴봤더니
5.5 버전으로 올라가면서 Source Compile 설치를 위해 cmake를 쓴다는 것을 알게 되었습니다.

때문에 Linux 서버에 cmake 가 설치되어 있지 않다면 MySQL을 설치할수가 없습니다.
이번 포스팅에서는 cmake를 설치해보겠습니다.

아주 간단합니다. ^^

※ 작업은 모두 root 계정으로 진행합니다.

우선 cmake 홈페이지에서 cmake를 다운로드 받습니다.

- cmake 다운로드 페이지 : http://www.cmake.org/cmake/resources/software.html

제공되는 다운로드는 두가지 타입이 있습니다.
Source distributionsBinary distributions 가 있는데, 소스 버전으로 작업합니다.

cmake 다운로드 페이지


작업 절차를 조금이라도 줄여주는 방법이 한가지 있다면,
서버 내에서 wget 을 이용해 직접 다운로드 받는 것입니다.

다운받을 파일의 URL을 확인한 후에 다음과 같은 방법으로
Linux 내에서 직접 다운로드 받습니다.


[root@linux-host ~]$ wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

--2011-04-20 17:49:44--  http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5477628 (5.2M) [application/x-gzip]
Saving to: `cmake-2.8.4.tar.gz'

100%[==========================================================================================>] 5,477,628    315K/s   in 17s

2011-04-20 17:50:02 (313 KB/s) - `cmake-2.8.4.tar.gz' saved [5477628/5477628]

[root@linux-host ~]$

위 방법으로 다운로드 받아도 되겠지만 인터넷이 안되는 서버라면 불가능하겠죠.

어떠한 방법으로든 cmake 소스 파일을 서버에 업로드 했으면 임시 디렉토리에 압축을 풉니다.

[root@linux-host ~]$ tar -xvf cmake-2.8.4.tar.gz
...
cmake-2.8.4/Utilities/cmcurl/ldap.c
cmake-2.8.4/Utilities/cmcurl/ldap.h
cmake-2.8.4/Utilities/cmcurl/llist.c
cmake-2.8.4/Utilities/cmcurl/llist.h
cmake-2.8.4/Utilities/cmcurl/md5.c
cmake-2.8.4/Utilities/cmcurl/md5.h
...
파일명 주르륵~

이제 압축이 풀린 디렉토리로 이동하여 다음과 같이 명령을 내립니다.

[root@linux-host ~]$ cd cmake-2.8.4
[root@linux-host ~]$ ./bootstrap
[root@linux-host ~]$ make
[root@linux-host ~]$ make install

이제 설치가 완료 됐습니다.
정상적으로 설치됐는지 확인해봐야겠죠.

다음과 같이 'cmake' 라고 명령을 하면 버전정보와 함께 Usage 정보가 출력됩니다.

[root@linux-host ~]$ cmake
cmake version 2.8.4
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.
  --graphviz=[file]           = Generate graphviz of dependencies.
  --system-information [file] = Dump information about this system.
  --debug-trycompile          = Do not delete the try compile directories..
  --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                      = 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 [file]            = Show program name/version banner and exit.

Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks 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.

이와 같이 나왔다면 정상 설치된 것입니다.

'OS > UnixLinux' 카테고리의 다른 글

AIX 디스크 파티션(용량) 할당 변경하기  (1) 2011.11.29
Linux 설치명 확인 방법  (0) 2011.04.22
Linux 사용자 추가하기  (0) 2011.04.21
Unix/Linux 에서의 cron 설정법  (0) 2010.06.15
공지사항