summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2011-05-26 14:53:12 +0200
committerMichael Schroeder <mls@suse.de>2011-05-26 14:53:12 +0200
commit1129ccb9a62c8d1474472495dda4356946a21e5c (patch)
treea7aa6ff65ae4bc4210ff6b86690599320f5067cb /src/CMakeLists.txt
parent66e7a252604ae81a027a2c7b8c437b7228eddcc4 (diff)
downloadlibsolv-1129ccb9a62c8d1474472495dda4356946a21e5c.tar.gz
libsolv-1129ccb9a62c8d1474472495dda4356946a21e5c.tar.bz2
libsolv-1129ccb9a62c8d1474472495dda4356946a21e5c.zip
- allow to build a shared and a static version of the libraries
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2966e6a..075d0a7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,9 +18,6 @@ SET (libsolv_SRCS
transaction.c rules.c problems.c
chksum.c md5.c sha1.c sha2.c satversion.c)
-ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
-SET_TARGET_PROPERTIES(libsolv PROPERTIES OUTPUT_NAME "solv")
-
SET (libsolv_HEADERS
bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h
poolid.h pooltypes.h queue.h solvable.h solver.h solverdebug.h
@@ -31,5 +28,21 @@ SET (libsolv_HEADERS
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver")
+IF (DISABLE_SHARED)
+ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
+ELSE (DISABLE_SHARED)
+ADD_LIBRARY (libsolv SHARED ${libsolv_SRCS})
+ENDIF (DISABLE_SHARED)
+
+SET_TARGET_PROPERTIES(libsolv PROPERTIES OUTPUT_NAME "solv")
+SET_TARGET_PROPERTIES(libsolv PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
+
INSTALL (FILES ${libsolv_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/solv")
INSTALL (TARGETS libsolv LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+
+IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
+ADD_LIBRARY (libsolv_static STATIC ${libsolv_SRCS})
+SET_TARGET_PROPERTIES(libsolv_static PROPERTIES OUTPUT_NAME "solv")
+SET_TARGET_PROPERTIES(libsolv_static PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
+INSTALL (TARGETS libsolv_static LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+ENDIF (ENABLE_STATIC AND NOT DISABLE_SHARED)