Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
9ba7946b
Commit
9ba7946b
authored
Aug 30, 2017
by
Herbert Thielen
Browse files
create different python based tests for single and multi configuration build generators
parent
47ad2993
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
googletest/cmake/internal_utils.cmake
googletest/cmake/internal_utils.cmake
+21
-9
No files found.
googletest/cmake/internal_utils.cmake
View file @
9ba7946b
...
@@ -237,20 +237,32 @@ endfunction()
...
@@ -237,20 +237,32 @@ endfunction()
# test/name.py. It does nothing if Python is not installed.
# test/name.py. It does nothing if Python is not installed.
function
(
py_test name
)
function
(
py_test name
)
if
(
PYTHONINTERP_FOUND
)
if
(
PYTHONINTERP_FOUND
)
# ${CMAKE_BINARY_DIR} is known at configuration time, so we can
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
# only at ctest runtime (by calling ctest -c <Configuration>), so
# we have to escape $ to delay variable substitution here.
if
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
if
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
if
(
CMAKE_CONFIGURATION_TYPES
)
# Multi-configuration build generators as for Visual Studio save
# output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug,
# Release etc.), so we have to provide it here.
add_test
(
NAME
${
name
}
COMMAND
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/
${
name
}
.py
--build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/$<CONFIG>
)
else
(
CMAKE_CONFIGURATION_TYPES
)
# Single-configuration build generators like Makefile generators
# don't have subdirs below CMAKE_CURRENT_BINARY_DIR.
add_test
(
add_test
(
NAME
${
name
}
NAME
${
name
}
COMMAND
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/
${
name
}
.py
COMMAND
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/
${
name
}
.py
--build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/$<CONFIGURATION>
)
--build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
)
endif
(
CMAKE_CONFIGURATION_TYPES
)
else
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
else
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
# ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
# only at ctest runtime (by calling ctest -c <Configuration>), so
# we have to escape $ to delay variable substitution here.
add_test
(
add_test
(
${
name
}
${
name
}
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/
${
name
}
.py
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/
${
name
}
.py
--build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/\
${
CTEST_CONFIGURATION_TYPE
}
)
--build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/\
${
CTEST_CONFIGURATION_TYPE
}
)
endif
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
endif
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
endif
()
endif
(
PYTHONINTERP_FOUND
)
endfunction
()
endfunction
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment