summaryrefslogtreecommitdiffstats
path: root/Tests/BuildDepends
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-11-05 13:05:08 (GMT)
committerBrad King <brad.king@kitware.com>2010-11-05 13:05:08 (GMT)
commit95f149e61f1ad8c8cadd74f2dbe36a2613815cc2 (patch)
treef1cec8d2621f029c8243db86ed1a73ec1bed4008 /Tests/BuildDepends
parent07cfa57ec5f9f906e075512646100719a0a615aa (diff)
downloadCMake-95f149e61f1ad8c8cadd74f2dbe36a2613815cc2.zip
CMake-95f149e61f1ad8c8cadd74f2dbe36a2613815cc2.tar.gz
CMake-95f149e61f1ad8c8cadd74f2dbe36a2613815cc2.tar.bz2
Define LINK_DEPENDS target property (#11406)
Custom Makefile link rules may need to depend on linker scripts. Define this property to allow user-specified link-time dependencies.
Diffstat (limited to 'Tests/BuildDepends')
-rw-r--r--Tests/BuildDepends/CMakeLists.txt23
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt5
-rw-r--r--Tests/BuildDepends/Project/linkdep.cxx4
3 files changed, 32 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 8714640..31392b5 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -34,6 +34,12 @@ if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
set(_cmake_options "-DCMAKE_EXE_LINKER_FLAGS=")
endif()
+if("${CMAKE_GENERATOR}" MATCHES "Make")
+ set(TEST_LINK_DEPENDS ${BuildDepends_BINARY_DIR}/Project/linkdep.txt)
+ file(WRITE ${TEST_LINK_DEPENDS} "1")
+endif()
+list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}")
+
file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
message("Creating Project/foo.cxx")
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
@@ -131,6 +137,10 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx
file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx
"static const char* zot_macro_tgt = \"zot_macro_tgt changed\";\n")
+if(TEST_LINK_DEPENDS)
+ file(WRITE ${TEST_LINK_DEPENDS} "2")
+endif()
+
help_xcode_depends()
message("Building project second time")
@@ -194,3 +204,16 @@ if("${out}" STREQUAL "${VALUE_CHANGED}")
else("${out}" STREQUAL "${VALUE_CHANGED}")
message(SEND_ERROR "Project did not rebuild properly!")
endif("${out}" STREQUAL "${VALUE_CHANGED}")
+
+if(TEST_LINK_DEPENDS)
+ set(linkdep ${BuildDepends_BINARY_DIR}/Project/linkdep${CMAKE_EXECUTABLE_SUFFIX})
+ if(${linkdep} IS_NEWER_THAN ${TEST_LINK_DEPENDS})
+ message("LINK_DEPENDS worked")
+ else()
+ message(SEND_ERROR "LINK_DEPENDS failed. Executable
+ ${linkdep}
+is not newer than dependency
+ ${TEST_LINK_DEPENDS}
+")
+ endif()
+endif()
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index e9d1296..70a2f37 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -80,3 +80,8 @@ set_property(
DIRECTORY
PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM "ZOT_DIR(%)=<zot_%_dir.hxx>"
)
+
+if(TEST_LINK_DEPENDS)
+ add_executable(linkdep linkdep.cxx)
+ set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS})
+endif()
diff --git a/Tests/BuildDepends/Project/linkdep.cxx b/Tests/BuildDepends/Project/linkdep.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/BuildDepends/Project/linkdep.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}