Windows에서 비 인터랙티브 빌드에 CMAKE를 사용하는 방법은 무엇입니까?

StackOverflow https://stackoverflow.com/questions/1459482

  •  12-09-2019
  •  | 
  •  

문제

Windows에서 CMAKE를 사용하여 자동 빌드를 설정하고 싶습니다. Visual Studio 2005를 사용하고 있습니다.

업데이트: 여기에 내가 사용하는 것은 다음과 같습니다.

나는 devenv.exe를 내 길로 설정했다. 그런 다음 빌드하기 위해 아래 명령을 실행합니다. Hudson을 사용하여 빌드하고 있습니다.

devenv crackpot.sln /빌드 디버그 /프로젝트 all_build

에 따라 http://blogs.msdn.com/aaronhallberg/archive/2007/06/29/building-from-the-command-line-with-devenv.aspx 후자가 GUI를 생성하여 빌드를 걸을 수 있으므로 "denenv.exe"가 아닌 "devenv"를 사용하는 것을 선호합니다.

도움이 되었습니까?

해결책

질문을 이해하는지 확실하지 않습니다. 다른 빌드 시스템과 똑같이 사용합니다. "Visual Studio 8 2005"만 지정하기 만하면 (약간 이상하지만, 매개 변수없이 CMAKE를 호출하여 지원되는 모든 시스템 목록을 얻을 수 있음) 명령 줄에 구축 할 수있는 솔루션이 얻을 수 있습니다. devenv.exe /build 또는 msbuild와 함께.

조금 복잡한 유일한 것은 빌드 서버에서와 같이 Visual Studio가 설치되지 않았을 때 솔루션을 생성하려는 경우입니다. 물론 설치할 수는 있지만 필요하지 않은 것을 설치하지 않는 것이 좋습니다. 이 경우 빌드 명령 줄로 MSBuild를 수락하려면 (명령 줄에서 배치 파일을 빌드 도구로 지정하여, 인수를 다시 표시하여 MSBuild가 수락 함). 비주얼 스튜디오를 놓치는 방법에 대해 (CMAKE 사람들이 지휘관 세계 출신이기 때문에 너무 미쳤습니다 ...)

아, 그리고 당신이 정말로 원하는 것이 명령 줄에 기존 Visual Studio 솔루션을 구축하는 것이라면 Cmake가 필요하지 않습니다. msbuild 또는 devenv /build.

다른 팁

내가 이것을하는 가장 간단한 방법은 다음과 같습니다.
% cmake --build "buildDir"
추가 할 수도 있습니다 --target 그리고 --config 'Debug|Release|...'

명령 줄에서 cmake를 실행할 수 있습니다. 당신은 달릴 수 있습니다.

cmake.exe -G"Visual Studio 8 2005" -H<source_dir> -B<build_dir>

아래는 원래 명령 줄 사용 출력의 스 니펫입니다. -H 및 -B 옵션은 문서화되지 않습니다. 그러나 명령 줄에서 소스를 명시 적으로 정의하고 디렉토리를 빌드하는 데 사용될 수 있습니다.

C:\Program Files (x86)\CMake 2.6\bin>cmake
  cmake version 2.6-patch 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.
  -N                          = View mode only.
  -P <file>                   = Process script mode.

사용 가능한 발전기는 다음과 같습니다.

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.
  Unix Makefiles              = Generates standard UNIX makefiles.
  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 .NET 2005 project
                                files.
  Visual Studio 8 2005 Win64  = Generates Visual Studio .NET 2005 Win64
                                project files.
  Visual Studio 9 2008        = Generates Visual Studio 9 2008 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 - 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 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.  

이것은 내가 만든 박쥐 파일입니다. 새 빌드 폴더를 삭제하고 생성 할 때마다 지정한 빌드 폴더에서 솔루션을 자동으로 생성합니다.

RMDIR C:\Users\abc /s /q

if EXIST C:\Users\abc GOTO FALIURE

MKDIR C:\Users\abc\build
CD C:\Users\abc\build
cmake -G "Visual Studio 12" "C:\Users\abc\src"
EXIT

:FALIURE
CLS
echo "Failed to delete BUILD directory, Close all related files and programs and try again."
pause
EXIT
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top