summaryrefslogtreecommitdiffstats
path: root/Tests/Complex/Executable
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-09-15 18:31:24 (GMT)
committerBrad King <brad.king@kitware.com>2006-09-15 18:31:24 (GMT)
commit07ec25e383920899c6c506be8f706da2d6db26eb (patch)
tree72f2c560411fad9ce09d8885ba2b4fa150eb32a4 /Tests/Complex/Executable
parent1d0502927c32cb3a14c101da16d7ab97901dc2a2 (diff)
downloadCMake-07ec25e383920899c6c506be8f706da2d6db26eb.zip
CMake-07ec25e383920899c6c506be8f706da2d6db26eb.tar.gz
CMake-07ec25e383920899c6c506be8f706da2d6db26eb.tar.bz2
ENH: Added test for linking to a static library that is next to a shared library. See bug#1644 for related changes.
Diffstat (limited to 'Tests/Complex/Executable')
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt6
-rw-r--r--Tests/Complex/Executable/complex.cxx19
2 files changed, 24 insertions, 1 deletions
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 12b1436..61624c9 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -37,6 +37,12 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
+# Test linking to static lib when a shared lib has the same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
+ TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 816414c..c4fc73b 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -23,6 +23,12 @@ extern "C" {
#include <string.h>
#endif
+#ifdef COMPLEX_TEST_LINK_STATIC
+extern "C"
+{
+ int TestLinkGetType();
+}
+#endif
int cm_passed = 0;
int cm_failed = 0;
@@ -1270,7 +1276,18 @@ int main()
// Test the generated file stream.
TestCMGeneratedFileSTream();
#endif
-
+
+#ifdef COMPLEX_TEST_LINK_STATIC
+ if(TestLinkGetType())
+ {
+ cmPassed("Link to static over shared worked.");
+ }
+ else
+ {
+ cmFailed("Link to static over shared failed.");
+ }
+#endif
+
// ----------------------------------------------------------------------
// Summary