C++ tests.
- C++ toolchain
- Microsoft Visual Studio 2015-2019
- MinGW 7+
- GCC 6+
- Clang 6+
- CMake 3.2+
yatest_home
environment variable is path to local copy of this repositorybuild_dir
environment variable specifies build directory, it may be different thanyatest_home
for "out of source tree" build, it may bebuild
subdirectory ofyatest_home
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
cmake -D CMAKE_BUILD_TYPE="${build_type}" -G "${cmake_generator}" "${yatest_home}"
-
Windows, Visual Studio CMake generator, shared C/C++ runtime
cmake -G "%cmake_generator%" -A "%cmake_platform%" "%yatest_home%"
-
Windows, Visual Studio CMake generator, static C/C++ runtime
cmake ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE="%yatest_home%\cmake\static_c_runtime_overrides.cmake" ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%yatest_home%\cmake\static_cxx_runtime_overrides.cmake" ^ -G "%cmake_generator%" -A "%cmake_platform%" "%yatest_home%"
-
Windows, NMake / MinGW makefiles CMake generator, static C/C++ runtime
cmake ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE="%yatest_home%\cmake\static_c_runtime_overrides.cmake" ^ -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%yatest_home%\cmake\static_cxx_runtime_overrides.cmake" ^ -D CMAKE_BUILD_TYPE="%build_type%" ^ -G "%cmake_generator%" "%yatest_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%"
-
-
Run tests, assuming current directory is
build_dir
-
Unix / Linux
ctest --build-config "${build_type}" --verbose
-
Windows
ctest --build-config "%build_type%" --verbose
-
Refer to