summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-30 22:26:09 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-30 22:26:09 (GMT)
commit109b5fc7a22b1f2e1711a7fcafff08c11f1bdb49 (patch)
treeef9f65cd1985267449764979424bacf497667498 /Tests
parent7902bc06aae07a9d4cde81ab41c3c86694d80a9b (diff)
downloadCMake-109b5fc7a22b1f2e1711a7fcafff08c11f1bdb49.zip
CMake-109b5fc7a22b1f2e1711a7fcafff08c11f1bdb49.tar.gz
CMake-109b5fc7a22b1f2e1711a7fcafff08c11f1bdb49.tar.bz2
ENH: Updated ExportImport test to try LINK_INTERFACE_LIBRARIES.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ExportImport/CMakeLists.txt20
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt21
-rw-r--r--Tests/ExportImport/Export/testExe2lib.c10
-rw-r--r--Tests/ExportImport/Export/testExe2libImp.c7
-rw-r--r--Tests/ExportImport/Export/testLib3.c5
-rw-r--r--Tests/ExportImport/Export/testLib3Imp.c7
-rw-r--r--Tests/ExportImport/Import/imp_mod1.c3
7 files changed, 59 insertions, 14 deletions
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt
index 3fb2dd3..3088228 100644
--- a/Tests/ExportImport/CMakeLists.txt
+++ b/Tests/ExportImport/CMakeLists.txt
@@ -11,15 +11,20 @@ set_property(
PROPERTY SYMBOLIC 1
)
-# Build and install the exporter.
if(CMAKE_CONFIGURATION_TYPES)
- set(Export_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
+ set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
else(CMAKE_CONFIGURATION_TYPES)
- set(Export_CONFIG_TYPE)
+ if(CMAKE_BUILD_TYPE)
+ set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}")
+ else(CMAKE_BUILD_TYPE)
+ set(NESTED_CONFIG_TYPE)
+ endif(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
+
+# Build and install the exporter.
add_custom_command(
OUTPUT ${ExportImport_BINARY_DIR}/ExportProject
- COMMAND ${CMAKE_CTEST_COMMAND} ${Export_CONFIG_TYPE}
+ COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
--build-and-test
${ExportImport_SOURCE_DIR}/Export
${ExportImport_BINARY_DIR}/Export
@@ -45,14 +50,9 @@ set_property(
)
# Build and install the importer.
-if(CMAKE_CONFIGURATION_TYPES)
- set(Import_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
-else(CMAKE_CONFIGURATION_TYPES)
- set(Import_CONFIG_TYPE)
-endif(CMAKE_CONFIGURATION_TYPES)
add_custom_command(
OUTPUT ${ExportImport_BINARY_DIR}/ImportProject
- COMMAND ${CMAKE_CTEST_COMMAND} ${Import_CONFIG_TYPE}
+ COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
--build-and-test
${ExportImport_SOURCE_DIR}/Import
${ExportImport_BINARY_DIR}/Import
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 24a3a56..8f0b304 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -9,14 +9,22 @@ add_library(testExe1lib STATIC testExe1lib.c) # not exported
add_executable(testExe1 testExe1.c)
target_link_libraries(testExe1 testExe1lib)
+add_library(testExe2libImp SHARED testExe2libImp.c)
+add_library(testExe2lib SHARED testExe2lib.c)
+target_link_libraries(testExe2lib testExe2libImp)
+set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "")
add_executable(testExe2 testExe2.c)
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)
+set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib)
add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
target_link_libraries(testLib2 testLib1)
+add_library(testLib3Imp SHARED testLib3Imp.c)
add_library(testLib3 SHARED testLib3.c)
+target_link_libraries(testLib3 testLib3Imp)
+set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
add_library(testLib4 SHARED testLib4.c)
set_property(TARGET testLib4 PROPERTY FRAMEWORK 1)
@@ -24,9 +32,18 @@ set_property(TARGET testLib4 PROPERTY FRAMEWORK 1)
add_executable(testExe3 testExe3.c)
set_property(TARGET testExe3 PROPERTY MACOSX_BUNDLE 1)
+# Install helper targets that are not part of the interface.
+install(
+ TARGETS testExe2libImp testLib3Imp
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
+
# Install and export from install tree.
install(
TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3
+ testExe2lib
EXPORT exp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
@@ -37,11 +54,11 @@ install(
install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp)
# Export from build tree.
-export(TARGETS testExe1 testLib1 testLib2
+export(TARGETS testExe1 testLib1 testLib2 testLib3
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
-export(TARGETS testExe2 testLib3 testLib4 testExe3
+export(TARGETS testExe2 testLib4 testExe3 testExe2lib
NAMESPACE bld_
APPEND FILE ExportBuildTree.cmake
)
diff --git a/Tests/ExportImport/Export/testExe2lib.c b/Tests/ExportImport/Export/testExe2lib.c
new file mode 100644
index 0000000..1991439
--- /dev/null
+++ b/Tests/ExportImport/Export/testExe2lib.c
@@ -0,0 +1,10 @@
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define testExe2lib_EXPORT __declspec(dllexport)
+# define testExe2libImp_IMPORT __declspec(dllimport)
+#else
+# define testExe2lib_EXPORT
+# define testExe2libImp_IMPORT
+#endif
+
+testExe2libImp_IMPORT int testExe2libImp(void);
+testExe2lib_EXPORT int testExe2lib(void) { return testExe2libImp(); }
diff --git a/Tests/ExportImport/Export/testExe2libImp.c b/Tests/ExportImport/Export/testExe2libImp.c
new file mode 100644
index 0000000..f5a23af
--- /dev/null
+++ b/Tests/ExportImport/Export/testExe2libImp.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define testExe2libImp_EXPORT __declspec(dllexport)
+#else
+# define testExe2libImp_EXPORT
+#endif
+
+testExe2libImp_EXPORT int testExe2libImp(void) { return 0; }
diff --git a/Tests/ExportImport/Export/testLib3.c b/Tests/ExportImport/Export/testLib3.c
index bfff187..31cec94 100644
--- a/Tests/ExportImport/Export/testLib3.c
+++ b/Tests/ExportImport/Export/testLib3.c
@@ -1,7 +1,10 @@
#if defined(_WIN32) || defined(__CYGWIN__)
# define testLib3_EXPORT __declspec(dllexport)
+# define testLib3Imp_IMPORT __declspec(dllimport)
#else
# define testLib3_EXPORT
+# define testLib3Imp_IMPORT
#endif
-testLib3_EXPORT int testLib3(void) { return 0; }
+testLib3Imp_IMPORT int testLib3Imp(void);
+testLib3_EXPORT int testLib3(void) { return testLib3Imp(); }
diff --git a/Tests/ExportImport/Export/testLib3Imp.c b/Tests/ExportImport/Export/testLib3Imp.c
new file mode 100644
index 0000000..fb4c13f
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib3Imp.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define testLib3Imp_EXPORT __declspec(dllexport)
+#else
+# define testLib3Imp_EXPORT
+#endif
+
+testLib3Imp_EXPORT int testLib3Imp(void) { return 0; }
diff --git a/Tests/ExportImport/Import/imp_mod1.c b/Tests/ExportImport/Import/imp_mod1.c
index d276631..579d949 100644
--- a/Tests/ExportImport/Import/imp_mod1.c
+++ b/Tests/ExportImport/Import/imp_mod1.c
@@ -5,8 +5,9 @@
#endif
testExe2_IMPORT int testExe2Func(void);
+testExe2_IMPORT int testExe2lib(void);
int imp_mod1()
{
- return testExe2Func();
+ return testExe2Func() + testExe2lib();
}