On Nov 8, 2010, at 4:39 PM, Rolf Eike Beer wrote:

Am Montag, 8. November 2010 schrieb Stormwind Developer:
Greetings,

I am a complete beginner to CMake, so my problem might be trivial.
Nevertheless I did not find a solution yet.

I am running Windows XP in a virtual machine on a linux host system.
Having CMake 2.6.4 installed I tried to run CMakeLists.txt from a
project I downloaded.

My problem is, that CMake fails with message logs like this one:
Check for working C compiler: E:/Programme/Microsoft Visual Studio
10.0/VC/bin/cl.exe
Check for working C compiler: E:/Programme/Microsoft Visual Studio
10.0/VC/bin/cl.exe -- broken
CMake Error at E:/Programme/CMake
2.6/share/cmake-2.6/Modules/CMakeTestCCompiler.cmake:32 (MESSAGE):
  The C compiler "E:/Programme/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is
  not able to compile a simple test program.

If you want to build a command line build (i.e. use MSVC only as a compiler, not as an IDE) you need to go to Start -> Programs -> Microsoft Visual Studio -> Tools -> x86 command prompt (or x64 if you want a 64 bit binary). From that shell you can call CMake like this and you will get a NMake makefile for your
project.

You need to start ANYTHING having to do with Visual Studio and CMake from this type of command prompt.

Note 1: You MUST have CMake 2.8.3 installed to use Visual Studio 2010.
Note 2: While in the command prompt and assuming "cmake" is located on your PATH variable you can launch the CMake GUI like this: cmake- gui.exe and the CMake-Gui application will inherit all the environment variables that the Visual Studio Command prompt sets up. Note 3: You can also run cmake from the command like like stated above giving cmake the -G argument to generate the type of projects you want.

 Type "cmake --help" for a list of those generators.

What I ended up doing what creating a new "Command Prompt" shortcut on my desktop, copied the contents from the bat file that the Visual Studio Command Prompt would have normally read and then injected some more paths. I'll append it at the end of this email. Note that this is for Visual Studio 2008. Yours would differ based on VS 2010.

This allows me to launch either a 32 bit project or a 64 bit project based on each batch file. I have one for each.

Hope that helps
Mike Jackson

@SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0
@SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework64
@SET FrameworkVersion=v2.0.50727
@SET Framework35Version=v3.5
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

@echo Setting environment for using Microsoft Visual Studio 2008 Beta2 x64 tools.

@call :GetWindowsSdkDir

@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin\x64;%WindowsSdkDir%bin \win64\x64;%WindowsSdkDir%bin;%PATH%"
        set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
        set "LIB=%WindowsSdkDir%lib\x64;%LIB%"
)

@set PATH=%VCINSTALLDIR%\BIN\amd64;%FrameworkDir%\%Framework35Version%; %FrameworkDir%\%Framework35Version%\Microsoft .NET Framework 3.5 (Pre- Release Version);%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR% \VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools; %VSINSTALLDIR%\Common7\Tools\bin;%PATH% @set INCLUDE=%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE; %INCLUDE%
@set LIB=%VCINSTALLDIR%\ATLMFC\LIB\amd64;%VCINSTALLDIR%\LIB\amd64;%LIB%

@set LIBPATH=%FrameworkDir%\%Framework35Version%;%FrameworkDir%\ %FrameworkVersion%;%FrameworkDir%\%Framework35Version%;%FrameworkDir%\ %FrameworkVersion%;%VCINSTALLDIR%\ATLMFC\LIB\amd64;%VCINSTALLDIR%\LIB \amd64;%LIBPATH%


@set ARCH_TYPE=x64
@set BOOST_ROOT=C:\Developer\%ARCH_TYPE%\MXABoost-1.36
@set EXPAT_INSTALL=C:\Developer\%ARCH_TYPE%\expat
@set HDF5_INSTALL=C:\Developer\%ARCH_TYPE%\hdf5-169
@set ITK_DIR=C:\Users\mjackson\Workspace\InsightToolkit-3.14.0\ %ARCH_TYPE%
@set MXADATAMODEL_INSTALL=C:\Developer\%ARCH_TYPE%\MXADataModel
@set QTDIR=C:\Developer\%ARCH_TYPE%\Qt-4.6.1
@set TIFF_INSTALL=C:\Developer\%ARCH_TYPE%\tiff
@set BJAM_INSTALL=C:\Applications\bjam

@SET PATH=%PATH%;C:\Applications\CMake-2.8.2\bin;%BJAM_INSTALL%

@echo BOOST_ROOT=%BOOST_ROOT%
@echo EXPAT_INSTALL=%EXPAT_INSTALL%
@echo HDF5_INSTALL=%HDF5_INSTALL%
@echo ITK_DIR=%ITK_DIR%
@echo MXADATAMODEL_INSTALL=%MXADATAMODEL_INSTALL%
@echo QTDIR=%QTDIR%
@echo TIFF_INSTALL=%TIFF_INSTALL%
@echo BJAM_INSTALL=%BJAM_INSTALL%


@goto end

:GetWindowsSdkDir
@call :GetWindowsSdkDirHelper HKLM > nul 2>&1
@if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
@if errorlevel 1 echo WindowsSdkDir not found
@exit /B 0

:GetWindowsSdkDirHelper
@SET WindowsSdkDir=
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft \Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
        if "%%i"=="CurrentInstallFolder" (
                SET "WindowsSdkDir=%%k"
        )
)
@if "%WindowsSdkDir%"=="" exit /B 1
@exit /B 0

:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set.
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end

:end

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to