ExternalProject: Add unit tests

This commit is contained in:
Daniele E. Domenichelli 2014-11-03 16:14:54 +01:00
parent f598f1aa83
commit 67cfbf8eb7
6 changed files with 89 additions and 1 deletions

View File

@ -19,6 +19,7 @@ set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(binary_base "${base}/Build")
set_property(DIRECTORY PROPERTY EP_BASE ${base})
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update)
set(do_git_tests 0)
@ -68,8 +69,8 @@ if(do_git_tests)
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_COMMAND ""
DEPENDS "SetupLocalGITRepository"
)
ExternalProject_Add_StepDependencies(${proj} download SetupLocalGITRepository)
set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
endif()

View File

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION})
include(ExternalProject)
ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz)
ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update)
ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something")
ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else")
ExternalProject_Add_StepTargets(FOO do_something)
# download and do_something_else are not targets, but the file-level
# dependency are set.
ExternalProject_Add_StepDependencies(FOO download BAR)
ExternalProject_Add_StepDependencies(FOO do_something_else BAR)
# update and do_something are targets, therefore both file-level and
# target-level dependencies are set.
ExternalProject_Add_StepDependencies(FOO update BAR)
ExternalProject_Add_StepDependencies(FOO do_something BAR)

View File

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION})
include(ExternalProject)
ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz)
ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update)
ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something")
ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else")
ExternalProject_Add_StepTargets(FOO do_something)

View File

@ -0,0 +1,36 @@
CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\):
Using NO_DEPENDS for "configure" step might break parallel builds
Call Stack \(most recent call first\):
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\)
NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\)
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\):
Using NO_DEPENDS for "build" step might break parallel builds
Call Stack \(most recent call first\):
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\)
NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\)
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\):
Using NO_DEPENDS for "install" step might break parallel builds
Call Stack \(most recent call first\):
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\)
.*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\)
NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\)
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\):
Using NO_DEPENDS for "test" step might break parallel builds
Call Stack \(most recent call first\):
NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\)
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 2.8.12)
include(ExternalProject RESULT_VARIABLE GOO)
set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS download patch update configure build)
ExternalProject_Add(FOO
URL https://example.org/foo.tar.gz)
ExternalProject_Add(BAR
URL https://example.org/bar.tar.gz
TEST_COMMAND echo test
INDEPENDENT_STEP_TARGETS install)
# This one should not give a warning
ExternalProject_Add_Step(BAR bar
COMMAND echo bar)
ExternalProject_Add_StepTargets(BAR NO_DEPENDS test bar)

View File

@ -3,3 +3,6 @@ include(RunCMake)
run_cmake(CMAKE_CACHE_ARGS)
run_cmake(CMAKE_CACHE_DEFAULT_ARGS)
run_cmake(CMAKE_CACHE_mix)
run_cmake(NO_DEPENDS)
run_cmake(Add_StepDependencies)
run_cmake(Add_StepDependencies_no_target)