summaryrefslogtreecommitdiffstats
path: root/Tests/ExternalProject
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ExternalProject')
-rw-r--r--Tests/ExternalProject/CMakeLists.txt4
-rw-r--r--Tests/ExternalProject/Step1Patch.cmake21
2 files changed, 24 insertions, 1 deletions
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 856a713..813cd4d 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -90,6 +90,7 @@ add_external_project(${proj}
DOWNLOAD_COMMAND ""
INSTALL_ARGS ""
INSTALL_COMMAND ""
+ PATCH_COMMAND ""
SVN_REPOSITORY ""
SVN_TAG ""
TAR ""
@@ -116,6 +117,7 @@ endif()
set(proj TutorialStep1-LocalTAR)
add_external_project(${proj}
TAR "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar"
+ PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
INSTALL_COMMAND ""
@@ -263,7 +265,7 @@ if(can_build_tutorial_step5)
endif()
add_test(TutorialStep1-LocalTAR-BuildTreeTest
- "${build_dir}/TutorialStep1-LocalTAR/Tutorial" 36)
+ "${build_dir}/TutorialStep1-LocalTAR/EP-Tutorial" 36)
add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest
"${build_dir}/TutorialStep1-LocalNoDirTAR/Tutorial" 25)
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")