diff options
author | Brad King <brad.king@kitware.com> | 2009-04-08 16:29:04 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-04-08 16:29:04 -0400 |
commit | d05e98f8d77e03c0c68ae3d7b5e5617f54dc6b07 (patch) | |
tree | 6e74a9ece72ee60b14423a2312ffc9add11ab0ef /Tests/ExportImport/Export | |
parent | 5886d103348ba7c14e464c851d3316f09cc2c0c6 (diff) | |
download | cmake-d05e98f8d77e03c0c68ae3d7b5e5617f54dc6b07.tar.gz |
ENH: Allow IMPORTED_IMPLIB w/o IMPORTED_LOCATION
Linking to a Windows shared library (.dll) requires only its import
library (.lib). This teaches CMake to recognize SHARED IMPORTED library
targets that set only IMPORTED_IMPLIB and not IMPORTED_LOCATION.
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib5.c | 7 |
2 files changed, 22 insertions, 1 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 26687b1c3b..19cd22f72d 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -39,6 +39,8 @@ set_property(TARGET testLib3 PROPERTY SOVERSION 3) add_library(testLib4 SHARED testLib4.c) set_property(TARGET testLib4 PROPERTY FRAMEWORK 1) +add_library(testLib5 SHARED testLib5.c) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -85,15 +87,27 @@ install( LIBRARY DESTINATION lib/impl ARCHIVE DESTINATION lib/impl ) +install( + TARGETS testLib5 + EXPORT exp + # Leave out RUNTIME DESTINATION to test implib-only export. + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp) +# Install testLib5.dll outside the export. +if(WIN32) + install(TARGETS testLib5 RUNTIME DESTINATION bin) +endif(WIN32) + # Export from build tree. export(TARGETS testExe1 testLib1 testLib2 testLib3 testExe2libImp testLib3Imp NAMESPACE bld_ FILE ExportBuildTree.cmake ) -export(TARGETS testExe2 testLib4 testExe3 testExe2lib +export(TARGETS testExe2 testLib4 testLib5 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake diff --git a/Tests/ExportImport/Export/testLib5.c b/Tests/ExportImport/Export/testLib5.c new file mode 100644 index 0000000000..20a8215132 --- /dev/null +++ b/Tests/ExportImport/Export/testLib5.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) || defined(__CYGWIN__) +# define testLib5_EXPORT __declspec(dllexport) +#else +# define testLib5_EXPORT +#endif + +testLib5_EXPORT int testLib5(void) { return 0; } |