diff options
author | Brad King <brad.king@kitware.com> | 2009-03-18 15:01:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-18 15:01:02 (GMT) |
commit | 2cc46c12f8d1a9b37a24e0cdcb0f31b8a0a8d6ae (patch) | |
tree | eae24e7fe267784667bebe9799a1cf66ab5d02f0 /Tests/ExternalProject/Step1Patch.cmake | |
parent | 6ae0ff626a67a2a81481bf127d07543d1f0cca16 (diff) | |
download | CMake-2cc46c12f8d1a9b37a24e0cdcb0f31b8a0a8d6ae.zip CMake-2cc46c12f8d1a9b37a24e0cdcb0f31b8a0a8d6ae.tar.gz CMake-2cc46c12f8d1a9b37a24e0cdcb0f31b8a0a8d6ae.tar.bz2 |
ENH: Add patch step for add_external_project
The patch step runs parallel to the update step since it does not make
sense to have both. Configuration of the step requires specification of
a PATCH_COMMAND argument to add_external_project.
Diffstat (limited to 'Tests/ExternalProject/Step1Patch.cmake')
-rw-r--r-- | Tests/ExternalProject/Step1Patch.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/ExternalProject/Step1Patch.cmake b/Tests/ExternalProject/Step1Patch.cmake new file mode 100644 index 0000000..1a1920a --- /dev/null +++ b/Tests/ExternalProject/Step1Patch.cmake @@ -0,0 +1,21 @@ +# Verify the current working directory. +if(NOT EXISTS CMakeLists.txt) + message(FATAL_ERROR "File does not exist:\n ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") +endif() +if(NOT EXISTS tutorial.cxx) + message(FATAL_ERROR "File does not exist:\n ${CMAKE_CURRENT_SOURCE_DIR}/tutorial.cxx") +endif() + +# Check if the patch is already applied. +file(STRINGS CMakeLists.txt prop_line REGEX "^set_property") +if(prop_line) + message(STATUS "Patch already applied!") + return() +endif() + +# Apply the patch. +file(APPEND CMakeLists.txt " +# Patch by ExternalProject test: +set_property(TARGET Tutorial PROPERTY OUTPUT_NAME EP-Tutorial) +") +message(STATUS "Patched ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") |