diff options
author | Brad King <brad.king@kitware.com> | 2017-02-24 14:31:39 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-02-24 14:31:39 (GMT) |
commit | 32f13fbe09fc8a5814bb3137abf2158cf1e24807 (patch) | |
tree | d998e97679fd0dad5dd7c77b6d96ae637e144957 /Tests | |
parent | 58ec4932e348814d70d70f7e60ad0c2fcb2240f7 (diff) | |
parent | 624021a09e7850b1f6cb75af40b17a38d98c95e3 (diff) | |
download | CMake-32f13fbe09fc8a5814bb3137abf2158cf1e24807.zip CMake-32f13fbe09fc8a5814bb3137abf2158cf1e24807.tar.gz CMake-32f13fbe09fc8a5814bb3137abf2158cf1e24807.tar.bz2 |
Merge topic '16615-xcode-object-libraries-depends'
624021a0 Add test for object library dependencies
5da9266a Xcode: Always track object library dependencies via hacky Makefile
e80ac953 Xcode: Record dependency information also for object libraries
9293e57d Xcode: Collect dummy rules during iteration and emit afterwards
33a1d727 Makefile: Allow adding post-build rules to object libraries
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/Dependencies.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 19 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/depends_lib.cpp | 7 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/depends_main.cpp | 7 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/depends_obj0.cpp | 4 | ||||
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/depends_obj1.cpp | 4 |
6 files changed, 52 insertions, 0 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/Dependencies.cmake b/Tests/RunCMake/ObjectLibrary/Dependencies.cmake new file mode 100644 index 0000000..4e3db5f --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/Dependencies.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.7) + +project(Dependencies) + +add_library(myobj OBJECT ${CMAKE_BINARY_DIR}/depends_obj.cpp) +add_library(mylib STATIC $<TARGET_OBJECTS:myobj> depends_lib.cpp) +add_executable(myexe depends_main.cpp) +target_link_libraries(myexe mylib) + +enable_testing() +add_test(NAME myexe COMMAND $<TARGET_FILE:myexe>) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 42973f8..9291218 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -16,3 +16,22 @@ run_cmake(ObjWithObj) run_cmake(PostBuild) run_cmake(PreBuild) run_cmake(PreLink) + +function(run_Dependencies) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Dependencies-build) + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} -E copy ${RunCMake_SOURCE_DIR}/depends_obj1.cpp ${RunCMake_TEST_BINARY_DIR}/depends_obj.cpp) + run_cmake(Dependencies) + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} --build .) + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} -E copy ${RunCMake_SOURCE_DIR}/depends_obj0.cpp ${RunCMake_TEST_BINARY_DIR}/depends_obj.cpp) + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} -E sleep 1) + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} -E touch_nocreate ${RunCMake_TEST_BINARY_DIR}/depends_obj.cpp) + run_cmake_command(Dependencies-build ${CMAKE_COMMAND} --build .) + run_cmake_command(Dependencies-build ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() + +run_Dependencies() diff --git a/Tests/RunCMake/ObjectLibrary/depends_lib.cpp b/Tests/RunCMake/ObjectLibrary/depends_lib.cpp new file mode 100644 index 0000000..540b536 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/depends_lib.cpp @@ -0,0 +1,7 @@ +#include <stdlib.h> +int myobj_foo(); + +void mylib_foo() +{ + exit(myobj_foo()); +} diff --git a/Tests/RunCMake/ObjectLibrary/depends_main.cpp b/Tests/RunCMake/ObjectLibrary/depends_main.cpp new file mode 100644 index 0000000..a9d323d --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/depends_main.cpp @@ -0,0 +1,7 @@ +void mylib_foo(); + +int main() +{ + mylib_foo(); + return 0; +} diff --git a/Tests/RunCMake/ObjectLibrary/depends_obj0.cpp b/Tests/RunCMake/ObjectLibrary/depends_obj0.cpp new file mode 100644 index 0000000..73a17e7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/depends_obj0.cpp @@ -0,0 +1,4 @@ +int myobj_foo() +{ + return 0; +} diff --git a/Tests/RunCMake/ObjectLibrary/depends_obj1.cpp b/Tests/RunCMake/ObjectLibrary/depends_obj1.cpp new file mode 100644 index 0000000..f62ef70 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/depends_obj1.cpp @@ -0,0 +1,4 @@ +int myobj_foo() +{ + return 1; +} |