James Kuszmaul | ba0ac1a | 2022-08-12 16:29:30 -0700 | [diff] [blame^] | 1 | # Create the build directory |
| 2 | execute_process ( |
| 3 | COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR} |
| 4 | RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED |
| 5 | ) |
| 6 | |
| 7 | if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) |
| 8 | message (FATAL_ERROR "Failed to create build directory") |
| 9 | endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0) |
| 10 | |
| 11 | if (GENERATOR_TOOLSET) |
| 12 | list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET}) |
| 13 | endif (GENERATOR_TOOLSET) |
| 14 | |
| 15 | if (GENERATOR_PLATFORM) |
| 16 | list (APPEND _ADDITIONAL_ARGS -A ${GENERATOR_PLATFORM}) |
| 17 | endif (GENERATOR_PLATFORM) |
| 18 | |
| 19 | # Run CMake |
| 20 | execute_process ( |
| 21 | # Capture the PATH environment variable content set during project generation |
| 22 | # stage. This is required because later during the build stage the PATH is |
| 23 | # modified again (e.g., for MinGW AppVeyor CI builds) by adding back the |
| 24 | # directory containing git.exe. Incidently, the Git installation directory |
| 25 | # also contains sh.exe which causes MinGW Makefile generation to fail. |
| 26 | COMMAND ${CMAKE_COMMAND} -E env PATH=${PATH} |
| 27 | ${CMAKE_COMMAND} -C ${INITIAL_CACHE} |
| 28 | -G ${GENERATOR} |
| 29 | ${_ADDITIONAL_ARGS} |
| 30 | -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON |
| 31 | -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON |
| 32 | -DCMAKE_PREFIX_PATH=${PACKAGE_DIR} |
| 33 | ${SOURCE_DIR} |
| 34 | WORKING_DIRECTORY ${TEST_BINARY_DIR} |
| 35 | RESULT_VARIABLE _GENERATE_SUCCEEDED |
| 36 | ) |
| 37 | |
| 38 | if (NOT _GENERATE_SUCCEEDED EQUAL 0) |
| 39 | message (FATAL_ERROR "Failed to generate project files using CMake") |
| 40 | endif (NOT _GENERATE_SUCCEEDED EQUAL 0) |