指定CMAKE構建32位/64位版本的程序


  • GCC (on Linux) and some other compilers, e.g Sun Studio. Set CFLAGS and CXXFLAGS to include -m32 (32-bit build) or -m64 (64-bit build).

  • Windows, Visual Studio generator .Use 64 bit generator ,e.g

    cmake -G "Visual Studio 10 Win64" path\to\source\dir

    to compile 64-bit (x64). Omit "Win64" in generator name, to build for 32 bit

  • Mac OS X. Use CMAKE_OSX_ARCHITECTURES CMake variable.

    cmake -DCMAKE_OSX_ARCHITECTURES=i386 /path/to/source/dir will compile 32 bit build

    cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 /path/to/source/dir will compile 64 bit.

    Finally, cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" /path/to/source/dir will create 96-bit universal binaries :)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM