summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-06-01 14:52:27 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-06-01 14:52:27 +0200
commit1880ef54d2c97c60ce9a29676f0214814c20d57b (patch)
tree5cf98bcf364aa34b789bee73f6a0cca2f5758c61
parent94ca5ed3dfb18307d82117584dff789333366c61 (diff)
downloadlibssh-1880ef54d2c97c60ce9a29676f0214814c20d57b.tar.gz
libssh-1880ef54d2c97c60ce9a29676f0214814c20d57b.tar.xz
libssh-1880ef54d2c97c60ce9a29676f0214814c20d57b.zip
cmake: Fix static .lib overwriting on Windows.
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/threads/CMakeLists.txt23
2 files changed, 28 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0cfa72d3..64eebf0a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -190,6 +190,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
@@ -199,6 +204,8 @@ if (WITH_STATIC_LIB)
${LIBRARY_SOVERSION}
OUTPUT_NAME
ssh
+ ARCHIVE_OUTPUT_DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SUFFIX}
)
if (WIN32)
@@ -214,7 +221,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
)