- C++ toolchain
- Microsoft Visual Studio 2015-2019
- MinGW 7+
- GCC 6+
- Clang 6+
- CMake 3.2+
- Boost C++ Libraries 1.73.0+
asio_test_home
environment variable contains path to local copy of this repositorybuild_dir
environment variable specifies build directory, it may be different thanasio_test_home
for "out of source tree" build, it may bebuild
subdirectory ofasio_test_home
- If Boost C++ Libraries are taken not from system paths, then header files of
Boost are located at directory specified by
boost_headers_dir
environment variable and binary files of Boost are located at directory specified byboost_libs_dir
environment variable build_type
environment variable specifies CMake build typeDebug
Release
RelWithDebInfo
MinSizeRel
cmake_generator
environment variable is CMake generatorVisual Studio 14 2015
- Visual Studio 2015Visual Studio 15 2017
- Visual Studio 2017Visual Studio 16 2019
- Visual Studio 2019NMake Makefiles
- NMake makefilesMinGW Makefiles
- MinGW makefilesUnix Makefiles
- Unix / Linux makefiles
cmake_platform
environment variable is CMAKE_GENERATOR_PLATFORMWin32
- x86 platform when using Visual Studiox64
- amd64 (x64) platform when using Visual Studio
- Unix / Linux commands use Bash
- Windows commands use Windows Command Prompt
-
Generate project for build system from CMake project, assuming current directory is
build_dir
-
Unix / Linux, Boost C++ Libraries are taken from system paths
cmake_generator="Unix Makefiles" && \ cmake -D CMAKE_BUILD_TYPE="${build_type}" -G "${cmake_generator}" "${asio_test_home}"
-
Windows, Visual Studio 2015 x64 CMake generator, shared C/C++ runtime, Boost C++ Libraries are taken not from system paths and are linked statically (refer to FindBoost CMake module for CMake variables which can be used to specify the way search for Boost C++ Libraries is performed)
set "cmake_generator=Visual Studio 14 2015" set "cmake_platform=x64" cmake ^ -D Boost_NO_SYSTEM_PATHS=ON ^ -D BOOST_INCLUDEDIR="%boost_headers_dir%" ^ -D BOOST_LIBRARYDIR="%boost_libs_dir%" ^ -D Boost_USE_STATIC_LIBS=ON ^ -G "%cmake_generator%" -A "%cmake_platform%" "%asio_test_home%"
-
Windows, Visual Studio 2015 x64 CMake generator, static C/C++ runtime, Boost C++ Libraries are taken not from system paths and are linked statically
set "cmake_generator=Visual Studio 14 2015" set "cmake_platform=x64" cmake ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE="%asio_test_home%\cmake\static_c_runtime_overrides.cmake" ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%asio_test_home%\cmake\static_cxx_runtime_overrides.cmake" ^ -D Boost_NO_SYSTEM_PATHS=ON ^ -D BOOST_INCLUDEDIR="%boost_headers_dir%" ^ -D BOOST_LIBRARYDIR="%boost_libs_dir%" ^ -D Boost_USE_STATIC_LIBS=ON ^ -G "%cmake_generator%" -A "%cmake_platform%" "%asio_test_home%"
-
Windows, MinGW makefiles CMake generator, static C/C++ runtime, Boost C++ Libraries are taken not from system paths and are linked statically
set "cmake_generator=MinGW Makefiles" cmake ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE="%asio_test_home%\cmake\static_c_runtime_overrides.cmake" ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%asio_test_home%\cmake\static_cxx_runtime_overrides.cmake" ^ -D Boost_NO_SYSTEM_PATHS=ON ^ -D BOOST_INCLUDEDIR="%boost_headers_dir%" ^ -D BOOST_LIBRARYDIR="%boost_libs_dir%" ^ -D Boost_USE_STATIC_LIBS=ON ^ -D CMAKE_BUILD_TYPE="%build_type%" ^ -G "%cmake_generator%" "%asio_test_home%"
-
-
Build generated project with build system chosen at previous step via CMake generator
-
Unix / Linux
cmake --build "${build_dir}" --config "${build_type}"
-
Windows
cmake --build "%build_dir%" --config "%build_type%"
-
Refer to