1. cmake
cmake 生成工程文件
Win set vs version
cmake -G Visual Studio 14 2015" -A Win32 -DCMAKE_BUILD_TYPE=relwithdebinfo ..
cmake -G Visual Studio 14 2015" -A x64 -DCMAKE_BUILD_TYPE=relwithdebinfo ..
Win auto
cmake -A x64 -DCMAKE_BUILD_TYPE=relwithdebinfo ..
cmake --build . --config relwithdebinfo -- /m:%NUMBER_OF_PROCESSORS%
linux
cmake -DCMAKE_BUILD_TYPE=relwithdebinfo ..
cmake --build . --config relwithdebinfo -- -j$(nproc)
cmake windows平台符号导出
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
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 :)
CMake Error: Could not find CMAKE_ROOT !!!” 的解决方法
1. (hash -r)
2. cmake3
sudo rm -rf /usr/bin/cmake
sudo ln /usr/bin/cmake3 /usr/bin/cmake
cmake -G Visual Studio 14 2015” -A Win32