diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-06-01 14:52:27 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-06-01 14:53:29 +0200 |
commit | 71fa0dc6bb5066e65e43aad90ac3be6219d8b67d (patch) | |
tree | 742d53afc122cd5b64faf033faa89e797d139ac1 | |
parent | 914a2d8e41f78b97f99592d03ca4172c0b7afcdb (diff) | |
download | libssh-71fa0dc6bb5066e65e43aad90ac3be6219d8b67d.tar.gz libssh-71fa0dc6bb5066e65e43aad90ac3be6219d8b67d.tar.xz libssh-71fa0dc6bb5066e65e43aad90ac3be6219d8b67d.zip |
cmake: Fix static .lib overwriting on Windows.
(cherry picked from commit 1880ef54d2c97c60ce9a29676f0214814c20d57b)
-rw-r--r-- | src/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/threads/CMakeLists.txt | 23 |
2 files changed, 28 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b478539..e158665d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,6 +184,11 @@ install( if (WITH_STATIC_LIB) add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS}) + if (MSVC) + set(OUTPUT_SUFFIX static) + else (MSVC) + set(OUTPUT_SUFFIX ) + endif (MSVC) set_target_properties( ${LIBSSH_STATIC_LIBRARY} PROPERTIES @@ -193,6 +198,8 @@ if (WITH_STATIC_LIB) ${LIBRARY_SOVERSION} OUTPUT_NAME ssh + ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SUFFIX} ) if (WIN32) @@ -208,7 +215,7 @@ if (WITH_STATIC_LIB) TARGETS ${LIBSSH_STATIC_LIBRARY} DESTINATION - ${LIB_INSTALL_DIR} + ${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX} COMPONENT libraries ) diff --git a/src/threads/CMakeLists.txt b/src/threads/CMakeLists.txt index 0373fee3..b95525e4 100644 --- a/src/threads/CMakeLists.txt +++ b/src/threads/CMakeLists.txt @@ -86,6 +86,12 @@ install( if (WITH_STATIC_LIB) add_library(${LIBSSH_THREADS_STATIC_LIBRARY} STATIC ${libssh_threads_SRCS}) + if (MSVC) + set(OUTPUT_SUFFIX static) + else (MSVC) + set(OUTPUT_SUFFIX ) + endif (MSVC) + set_target_properties( ${LIBSSH_THREADS_STATIC_LIBRARY} PROPERTIES @@ -93,15 +99,26 @@ if (WITH_STATIC_LIB) ${LIBRARY_VERSION} SOVERSION ${LIBRARY_SOVERSION} - COMPILE_FLAGS - "-DLIBSSH_STATIC" + OUTPUT_NAME + ssh_threads + ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SUFFIX} + ) + + if (WIN32) + set_target_properties( + ${LIBSSH_THREADS_STATIC_LIBRARY} + PROPERTIES + COMPILE_FLAGS + "-DLIBSSH_STATIC" ) + endif (WIN32) install( TARGETS ${LIBSSH_THREADS_STATIC_LIBRARY} DESTINATION - ${LIB_INSTALL_DIR} + ${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX} COMPONENT libraries ) |