summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-02 11:57:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-10-02 11:57:25 (GMT)
commita1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6 (patch)
tree853e8fa45bcab56c6616319ddf91d09ce205aaee /Tests
parentd57c1a5b3116d1df1bd5a7c2d9857e7b96d2a4f4 (diff)
parent4891f0f9662d6e2b355717aa1f7250f3462229bb (diff)
downloadCMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.zip
CMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.tar.gz
CMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.tar.bz2
Merge topic 'ninja-depend-shared-symlinks'
4891f0f966 Ninja: Ensure shared library version symlinks are created for dependents Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3875
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.c17
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake12
2 files changed, 27 insertions, 2 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.c b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.c
new file mode 100644
index 0000000..088da30
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.c
@@ -0,0 +1,17 @@
+#ifndef REQUIRED
+# error "REQUIRED not defined"
+#endif
+
+#if defined(_WIN32)
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
+IMPORT int a(void);
+extern int required(void);
+
+int main(void)
+{
+ return required() + a();
+}
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
index 4aa7bba..0a76932 100644
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
@@ -1,7 +1,15 @@
project(LinkObjLHSShared C)
+# Create a versioned shared library that does not build as part of "all".
add_library(OtherLib SHARED a.c)
-target_compile_definitions(OtherLib INTERFACE REQUIRED)
+target_compile_definitions(OtherLib INTERFACE REQUIRED PRIVATE COMPILE_FOR_SHARED_LIB)
+set_target_properties(OtherLib PROPERTIES SOVERSION 0 VERSION 0.0.0 EXCLUDE_FROM_ALL ON)
add_library(AnObjLib OBJECT requires.c)
-target_link_libraries(AnObjLib OtherLib)
+target_link_libraries(AnObjLib PUBLIC OtherLib)
+
+add_executable(LinkObjLHSShared LinkObjLHSShared.c)
+target_link_libraries(LinkObjLHSShared AnObjLib)
+
+# Verify that our dependency on OtherLib generated its versioning symlinks.
+add_custom_command(TARGET LinkObjLHSShared POST_BUILD COMMAND LinkObjLHSShared)