Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2008 CMake为Win32和x64生成Visual Studio 2008解决方案_Visual Studio 2008_64 Bit_Cmake - Fatal编程技术网

Visual studio 2008 CMake为Win32和x64生成Visual Studio 2008解决方案

Visual studio 2008 CMake为Win32和x64生成Visual Studio 2008解决方案,visual-studio-2008,64-bit,cmake,Visual Studio 2008,64 Bit,Cmake,我正在Windows XP下使用CMake 2.8,希望生成一个Visual Studio 2008解决方案文件,其中包含Win32和x64的发布和调试配置 这可以通过在CMakeLists.txt文件中设置CMake配置变量来实现吗?CMakeLists不是为项目指定生成器(makefile、XCode、Visual Studio)的位置。当用户在源上运行CMake时,将指定生成器。CMakeLists不是为项目指定生成器(makefile、XCode、Visual Studio)的位置。当用

我正在Windows XP下使用CMake 2.8,希望生成一个Visual Studio 2008解决方案文件,其中包含Win32和x64的发布和调试配置


这可以通过在
CMakeLists.txt
文件中设置CMake配置变量来实现吗?

CMakeLists不是为项目指定生成器(makefile、XCode、Visual Studio)的位置。当用户在源上运行CMake时,将指定生成器。

CMakeLists不是为项目指定生成器(makefile、XCode、Visual Studio)的位置。当用户在您的源上运行CMake时,将指定生成器。

您应该在控制台下使用CMake.exe生成解决方案文件

CMake-G“Visual Studio 9 2008”(包含CMakeLists.txt文件的目录)//这是用于X86的


CMake-G“Visual Studio 9 2008 Win64”(包含CMakeLists.txt文件的目录)//这是用于X64的。

您应该在控制台下使用CMake.exe生成一个解决方案文件

CMake-G“Visual Studio 9 2008”(包含CMakeLists.txt文件的目录)//这是用于X86的

CMake-G“Visual Studio 9 2008 Win64”(包含CMakeLists.txt文件的目录)//这是用于X64的。

您肯定应该使用批处理脚本来自动化此类过程。我与您共享我自己的生成器脚本的简化版本。我自己的环境要复杂得多,因此我编写了这个脚本供您轻松使用。 它的用法非常基本

builder . -64bit -Debug
表示源代码位于当前目录中,编译配置为64位调试版本

您只需要更改脚本中的全局配置变量 visual studio目录和cmake目录

设置VISUAL STUDIO\u 9\u主页=

@echo off

rem ===== Usage
rem builder c:\workspace\project1 -32bit -Release
rem builder . -64bit -Debug

rem Global configuration variables. Should be update based on your system
SET VISUAL_STUDIO_9_HOME=c:\Program Files\Microsoft Visual Studio 9.0
SET CMAKE_HOME=c:\Documents and Settings\stumk\My Documents\toolkit\cmake

rem First parameter is project folder path
SET PROJECT_DIR=%1

rem Add executables into path
rem Only add them once
if NOT DEFINED SETENV  SET SETENV=0
if %SETENV% EQU 0 SET PATH=%CMAKE_HOME%\bin;%VISUAL_STUDIO_9_HOME%\Common7\Tools;%PATH%
SET SETENV=1

rem Go to project director
cd %PROJECT_DIR%

rem Create build folder, don't mess the source code with visual studio project files
md build

rem Go to build folder
cd build\
   rem Set visual studio environment variables
   call vsvars32.bat 

   rem Second parameter defines 32 bit or 64 bit compilation
   if "%2"=="-32bit" (
       cmake.exe .. -G "Visual Studio 9 2008"
   )
   if "%2"=="-64bit" (
       cmake.exe .. -G "Visual Studio 9 2008 Win64"
   )

   rem Third parameter defines debug or release compilation
   if "%3"=="-Debug" (
           cmake.exe --build . --target ALL_BUILD --config Debug
   )
   if "%3"=="-Release" (
           cmake.exe --build . --target ALL_BUILD --config Release
   )

   rem Go to source code directory and finalize script
   cd ..

@echo on
设置CMAKE_HOME=

@echo off

rem ===== Usage
rem builder c:\workspace\project1 -32bit -Release
rem builder . -64bit -Debug

rem Global configuration variables. Should be update based on your system
SET VISUAL_STUDIO_9_HOME=c:\Program Files\Microsoft Visual Studio 9.0
SET CMAKE_HOME=c:\Documents and Settings\stumk\My Documents\toolkit\cmake

rem First parameter is project folder path
SET PROJECT_DIR=%1

rem Add executables into path
rem Only add them once
if NOT DEFINED SETENV  SET SETENV=0
if %SETENV% EQU 0 SET PATH=%CMAKE_HOME%\bin;%VISUAL_STUDIO_9_HOME%\Common7\Tools;%PATH%
SET SETENV=1

rem Go to project director
cd %PROJECT_DIR%

rem Create build folder, don't mess the source code with visual studio project files
md build

rem Go to build folder
cd build\
   rem Set visual studio environment variables
   call vsvars32.bat 

   rem Second parameter defines 32 bit or 64 bit compilation
   if "%2"=="-32bit" (
       cmake.exe .. -G "Visual Studio 9 2008"
   )
   if "%2"=="-64bit" (
       cmake.exe .. -G "Visual Studio 9 2008 Win64"
   )

   rem Third parameter defines debug or release compilation
   if "%3"=="-Debug" (
           cmake.exe --build . --target ALL_BUILD --config Debug
   )
   if "%3"=="-Release" (
           cmake.exe --build . --target ALL_BUILD --config Release
   )

   rem Go to source code directory and finalize script
   cd ..

@echo on
您肯定应该使用批处理脚本来自动化这些过程。我与您共享我自己的生成器脚本的简化版本。我自己的环境要复杂得多,因此我编写了这个脚本供您轻松使用。 它的用法非常基本

builder . -64bit -Debug
表示源代码位于当前目录中,编译配置为64位调试版本

您只需要更改脚本中的全局配置变量 visual studio目录和cmake目录

设置VISUAL STUDIO\u 9\u主页=

@echo off

rem ===== Usage
rem builder c:\workspace\project1 -32bit -Release
rem builder . -64bit -Debug

rem Global configuration variables. Should be update based on your system
SET VISUAL_STUDIO_9_HOME=c:\Program Files\Microsoft Visual Studio 9.0
SET CMAKE_HOME=c:\Documents and Settings\stumk\My Documents\toolkit\cmake

rem First parameter is project folder path
SET PROJECT_DIR=%1

rem Add executables into path
rem Only add them once
if NOT DEFINED SETENV  SET SETENV=0
if %SETENV% EQU 0 SET PATH=%CMAKE_HOME%\bin;%VISUAL_STUDIO_9_HOME%\Common7\Tools;%PATH%
SET SETENV=1

rem Go to project director
cd %PROJECT_DIR%

rem Create build folder, don't mess the source code with visual studio project files
md build

rem Go to build folder
cd build\
   rem Set visual studio environment variables
   call vsvars32.bat 

   rem Second parameter defines 32 bit or 64 bit compilation
   if "%2"=="-32bit" (
       cmake.exe .. -G "Visual Studio 9 2008"
   )
   if "%2"=="-64bit" (
       cmake.exe .. -G "Visual Studio 9 2008 Win64"
   )

   rem Third parameter defines debug or release compilation
   if "%3"=="-Debug" (
           cmake.exe --build . --target ALL_BUILD --config Debug
   )
   if "%3"=="-Release" (
           cmake.exe --build . --target ALL_BUILD --config Release
   )

   rem Go to source code directory and finalize script
   cd ..

@echo on
设置CMAKE_HOME=

@echo off

rem ===== Usage
rem builder c:\workspace\project1 -32bit -Release
rem builder . -64bit -Debug

rem Global configuration variables. Should be update based on your system
SET VISUAL_STUDIO_9_HOME=c:\Program Files\Microsoft Visual Studio 9.0
SET CMAKE_HOME=c:\Documents and Settings\stumk\My Documents\toolkit\cmake

rem First parameter is project folder path
SET PROJECT_DIR=%1

rem Add executables into path
rem Only add them once
if NOT DEFINED SETENV  SET SETENV=0
if %SETENV% EQU 0 SET PATH=%CMAKE_HOME%\bin;%VISUAL_STUDIO_9_HOME%\Common7\Tools;%PATH%
SET SETENV=1

rem Go to project director
cd %PROJECT_DIR%

rem Create build folder, don't mess the source code with visual studio project files
md build

rem Go to build folder
cd build\
   rem Set visual studio environment variables
   call vsvars32.bat 

   rem Second parameter defines 32 bit or 64 bit compilation
   if "%2"=="-32bit" (
       cmake.exe .. -G "Visual Studio 9 2008"
   )
   if "%2"=="-64bit" (
       cmake.exe .. -G "Visual Studio 9 2008 Win64"
   )

   rem Third parameter defines debug or release compilation
   if "%3"=="-Debug" (
           cmake.exe --build . --target ALL_BUILD --config Debug
   )
   if "%3"=="-Release" (
           cmake.exe --build . --target ALL_BUILD --config Release
   )

   rem Go to source code directory and finalize script
   cd ..

@echo on

我知道。但是有没有办法让Visual Studio generator生成一个解决方案文件,允许在Windows XP下交叉编译x64?没有,您需要单独的解决方案文件,并为x32和x64生成目录。这两个都包含发布和调试配置。我想你是指x86而不是x32。我知道。但是有没有办法让Visual Studio generator生成一个解决方案文件,允许在Windows XP下交叉编译x64?没有,您需要单独的解决方案文件,并为x32和x64生成目录。这两个都将包含发布和调试配置。我想你是指x86而不是x32。