[cmake] Fixed path passed to cram on windows builds
This commit is contained in:
parent
1b5af3bc4c
commit
60de40708d
2 changed files with 37 additions and 19 deletions
36
.cmake/Modules/Cram.cmake
Normal file
36
.cmake/Modules/Cram.cmake
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Copyright (C) 2015-2016 Franklin "Snaipe" Mathieu.
|
||||
# Redistribution and use of this file is allowed according to the terms of the MIT license.
|
||||
# For details see the LICENSE file distributed with Criterion.
|
||||
|
||||
set(PATH_VAR
|
||||
"${PROJECT_BINARY_DIR}/samples"
|
||||
"${PROJECT_BINARY_DIR}/samples/tests"
|
||||
"${PROJECT_BINARY_DIR}/external/lib"
|
||||
"${PROJECT_BINARY_DIR}/external/bin"
|
||||
)
|
||||
|
||||
set(NEW_PATH "")
|
||||
foreach (P ${PATH_VAR})
|
||||
file (TO_NATIVE_PATH "${P}" P)
|
||||
message ("${P}")
|
||||
list (APPEND NEW_PATH "${P}")
|
||||
endforeach ()
|
||||
set (PATH_VAR "${NEW_PATH}")
|
||||
|
||||
if (NOT WIN32)
|
||||
string (REPLACE ";" ":" PATH_VAR "${PATH_VAR}")
|
||||
set(ENV{PATH} "$ENV{PATH}:${PATH_VAR}")
|
||||
else ()
|
||||
set(ENV{PATH} "$ENV{PATH};${PATH_VAR}")
|
||||
endif ()
|
||||
|
||||
message ("path = $ENV{PATH}")
|
||||
|
||||
set(ENV{LC_ALL} "en_US.utf8")
|
||||
set(ENV{CRITERION_ALWAYS_SUCCEED} "1")
|
||||
set(ENV{CRITERION_SHORT_FILENAME} "1")
|
||||
set(ENV{CRITERION_NO_EARLY_EXIT} "1")
|
||||
set(ENV{CRITERION_JOBS} "1")
|
||||
set(ENV{CRITERION_DISABLE_TIME_MEASUREMENTS} "1")
|
||||
|
||||
execute_process (COMMAND cram -v ${CRAM_PATH})
|
|
@ -36,25 +36,7 @@ set_property(TEST criterion_unit_tests PROPERTY
|
|||
if (NOT MSVC) # we disable the scripted tests when building with MSVC
|
||||
add_custom_target(cram_tests)
|
||||
|
||||
set(PATH_VAR
|
||||
$ENV{PATH}
|
||||
"${PROJECT_BINARY_DIR}/samples"
|
||||
"${PROJECT_BINARY_DIR}/samples/tests"
|
||||
"${PROJECT_BINARY_DIR}/external/lib"
|
||||
"${PROJECT_BINARY_DIR}/external/bin"
|
||||
)
|
||||
string (REPLACE ";" ":" PATH_VAR "${PATH_VAR}")
|
||||
|
||||
set(CMD "")
|
||||
set(CMD "${CMD}PATH=${PATH_VAR} ")
|
||||
set(CMD "${CMD}LC_ALL=en_US.utf8 ")
|
||||
set(CMD "${CMD}CRITERION_ALWAYS_SUCCEED=1 ")
|
||||
set(CMD "${CMD}CRITERION_SHORT_FILENAME=1 ")
|
||||
set(CMD "${CMD}CRITERION_NO_EARLY_EXIT=1 ")
|
||||
set(CMD "${CMD}CRITERION_JOBS=1 ")
|
||||
set(CMD "${CMD}CRITERION_DISABLE_TIME_MEASUREMENTS=1 ")
|
||||
set(CMD "${CMD}cram -v ${CMAKE_CURRENT_SOURCE_DIR}/cram")
|
||||
add_custom_command(TARGET cram_tests POST_BUILD COMMAND sh -c "${CMD}")
|
||||
add_custom_command(TARGET cram_tests POST_BUILD COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/Cram.cmake")
|
||||
add_dependencies(cram_tests criterion_samples)
|
||||
|
||||
add_test(cram_tests make cram_tests)
|
||||
|
|
Loading…
Add table
Reference in a new issue