diff options
author | Brad King <brad.king@kitware.com> | 2009-07-11 14:10:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-07-11 14:10:51 (GMT) |
commit | 3621e073a88433af4408a8d7d58974b4e8254b54 (patch) | |
tree | 770cb042e07ef712ce4ec395985881f7735e096e /Tests/ExportImport/Export | |
parent | 28b1912aa3eba8427cc3d0a4954f7366fcb338b9 (diff) | |
download | CMake-3621e073a88433af4408a8d7d58974b4e8254b54.zip CMake-3621e073a88433af4408a8d7d58974b4e8254b54.tar.gz CMake-3621e073a88433af4408a8d7d58974b4e8254b54.tar.bz2 |
ENH: Test export/import of link interface languages
This extends the ExportImport test. The Export project creates a C++
static library and exports it. Then the Import project links the
library into a C executable. On most platforms the executable will link
only if the C++ linker is chosen correctly.
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib6.c | 5 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib6.cxx | 6 |
3 files changed, 17 insertions, 3 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 4de3f64..1588b0c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.6) -project(Export C) +cmake_minimum_required (VERSION 2.7.20090711) +project(Export C CXX) # Pretend that RelWithDebInfo should link to debug libraries to test # the DEBUG_CONFIGURATIONS property. @@ -45,6 +45,8 @@ set_property(TARGET testLib4 PROPERTY FRAMEWORK 1) add_library(testLib5 SHARED testLib5.c) +add_library(testLib6 STATIC testLib6.cxx testLib6.c) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -76,6 +78,7 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt + testLib6 EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -111,7 +114,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 NAMESPACE bld_ FILE ExportBuildTree.cmake ) -export(TARGETS testExe2 testLib4 testLib5 testExe3 testExe2lib +export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake diff --git a/Tests/ExportImport/Export/testLib6.c b/Tests/ExportImport/Export/testLib6.c new file mode 100644 index 0000000..493ca07 --- /dev/null +++ b/Tests/ExportImport/Export/testLib6.c @@ -0,0 +1,5 @@ +extern int testLib6cxx(void); +int testLib6(void) +{ + return testLib6cxx(); +} diff --git a/Tests/ExportImport/Export/testLib6.cxx b/Tests/ExportImport/Export/testLib6.cxx new file mode 100644 index 0000000..338e639 --- /dev/null +++ b/Tests/ExportImport/Export/testLib6.cxx @@ -0,0 +1,6 @@ +extern "C" int testLib6cxx(void) +{ + // Reference C++ standard library symbols. + delete new int; + return 0; +} |