cmakeコンパイル32/64ビット

1070 ワード

linux:
方法一(オプション):option(USE_32 BITS「Compile for 32 bits processors(linux only)」OFF)
メソッド2(コマンド):CMake..DUSE_32 BITS=1(make_solution.shまで書ける)
CMakelist.txt: 
if(USE_32BITS)
 message(STATUS "using 32bits")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")

 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")

else()
endif(USE_32BITS)

windows:
以下にmake_solution.bat中
x86: 
@echo off
::
:: Run this batch file to create Visual studio solution file for this project.
:: Seet the cmake documentation for other generator targets
::
cmake -G "Visual Studio 10" ../.. && cmake-gui ../..

x64:
@echo off
::
:: Run this batch file to create Visual studio solution file for this project.
:: Seet the cmake documentation for other generator targets
::
cmake -G "Visual Studio 10 Win64" ../.. && cmake-gui ../..