summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-23 16:03:39 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-23 16:04:37 (GMT)
commita41f375e65ad764f7512ebf9edd1370adaec24f7 (patch)
tree3606e69f115fcbab7314cfccf0dcad2973c08dcc /Tests
parentc9a3ae13563f1e66d90225fff98fbc207195c155 (diff)
parente02f677f61030f6c74f06ecd56092521dd68cab4 (diff)
downloadCMake-a41f375e65ad764f7512ebf9edd1370adaec24f7.zip
CMake-a41f375e65ad764f7512ebf9edd1370adaec24f7.tar.gz
CMake-a41f375e65ad764f7512ebf9edd1370adaec24f7.tar.bz2
Merge topic 'test-issue-21144'
e02f677f61 Tests: Add test for early source lookup of file(GENERATE) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5248
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/File_Generate/GenerateSource.cmake3
-rw-r--r--Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt8
2 files changed, 11 insertions, 0 deletions
diff --git a/Tests/RunCMake/File_Generate/GenerateSource.cmake b/Tests/RunCMake/File_Generate/GenerateSource.cmake
index 147a7f6..d5504e3 100644
--- a/Tests/RunCMake/File_Generate/GenerateSource.cmake
+++ b/Tests/RunCMake/File_Generate/GenerateSource.cmake
@@ -10,3 +10,6 @@ file(GENERATE
)
add_executable(mn "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+
+add_subdirectory(GenerateSource)
+target_link_libraries(mn PRIVATE ObjLib)
diff --git a/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt b/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt
new file mode 100644
index 0000000..bca8922
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/GenerateSource/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_library(ObjLib OBJECT)
+
+target_sources(ObjLib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp")
+
+# Ensure re-generation
+file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp")
+
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ObjLib.cpp" CONTENT "")