diff options
-rw-r--r-- | CMakeLists.txt | 21 | ||||
-rw-r--r-- | VERSION.cmake | 3 | ||||
-rw-r--r-- | examples/CMakeLists.txt | 12 | ||||
-rw-r--r-- | ext/CMakeLists.txt | 23 | ||||
-rw-r--r-- | src/CMakeLists.txt | 19 | ||||
-rw-r--r-- | tools/CMakeLists.txt | 31 |
6 files changed, 70 insertions, 39 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 618be03..72677de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,16 @@ PROJECT (libsolv) -cmake_minimum_required (VERSION 2.4) +CMAKE_MINIMUM_REQUIRED (VERSION 2.4) + +OPTION(ENABLE_STATIC "Build a static version of the libraries?" OFF) +OPTION(DISABLE_SHARED "Do not build a shared version of the libraries?" OFF) #IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4) #ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4) IF (COMMAND cmake_policy) # escape preprocessor, see -DVERSION below - cmake_policy (SET CMP0005 OLD) + CMAKE_POLICY (SET CMP0005 OLD) ENDIF (COMMAND cmake_policy) # Library @@ -109,7 +112,7 @@ ADD_DEFINITIONS (-D_FILE_OFFSET_BITS=64) ADD_DEFINITIONS (-DVERSION=\\\"${VERSION}\\\") CONFIGURE_FILE (src/satversion.h.in src/satversion.h) -SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "SAT Solver library") +SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Package dependency solver library") SET (CPACK_PACKAGE_VENDOR "SUSE") SET (CPACK_PACKAGE_VERSION_MAJOR ${LIBSOLV_MAJOR}) SET (CPACK_PACKAGE_VERSION_MINOR ${LIBSOLV_MINOR}) @@ -162,14 +165,6 @@ SET (CPACK_SOURCE_IGNORE_FILES INCLUDE(CPack) #################################################################### - -SET (DOC_INSTALL_DIR - "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PACKAGE}" - CACHE PATH "The install dir for documentation (default prefix/share/doc/packages/${PACKAGE})" - FORCE -) - -#################################################################### # INCLUDES # #################################################################### @@ -178,9 +173,9 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOU #################################################################### -MESSAGE (STATUS "Looking modules in ${CMAKE_MODULE_PATH}") +MESSAGE (STATUS "Looking for modules in ${CMAKE_MODULE_PATH}") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall") +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Wl,--as-needed") set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -g -O3") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0") diff --git a/VERSION.cmake b/VERSION.cmake index d11f403..2dc7a4c 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -44,6 +44,9 @@ # set COMPATMINOR to MINOR. (binary incompatible change) # +SET(LIBSOLV_SOVERSION "0") +SET(LIBSOLVEXT_SOVERSION "0") + SET(LIBSOLV_MAJOR "0") SET(LIBSOLV_MINOR "0") SET(LIBSOLV_PATCH "0") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c3264a9..1d69d21 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,9 +1,11 @@ +# as we link with --as-needed we do not get bogus dependencies +SET (SYSTEM_LIBRARIES ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) +IF (NOT DEBIAN) +SET (SYSTEM_LIBRARIES ${RPMDB_LIBRARY} ${SYSTEM_LIBRARIES}) +ENDIF (NOT DEBIAN) + ADD_EXECUTABLE (solv solv.c) -IF (DEBIAN) -TARGET_LINK_LIBRARIES (solv libsolvext libsolv ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) -ELSE (DEBIAN) -TARGET_LINK_LIBRARIES (solv libsolvext libsolv ${RPMDB_LIBRARY} ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) -ENDIF (DEBIAN) +TARGET_LINK_LIBRARIES (solv libsolvext libsolv ${SYSTEM_LIBRARIES}) INSTALL(TARGETS solv diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index f444667..687ff92 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -4,13 +4,10 @@ SET (libsolvext_SRCS repo_susetags.c repo_updateinfoxml.c repo_write.c repo_zyppdb.c repo_deb.c sat_xfopen.c) IF (NOT DEBIAN) -SET (libsolvext_SRCS - ${libsolvext_SRCS} pool_fileconflicts.c repo_rpmdb.c) +SET (libsolvext_SRCS ${libsolvext_SRCS} + pool_fileconflicts.c repo_rpmdb.c) ENDIF (NOT DEBIAN) -ADD_LIBRARY (libsolvext STATIC ${libsolvext_SRCS}) -SET_TARGET_PROPERTIES(libsolvext PROPERTIES OUTPUT_NAME "solvext") - SET (libsolvext_HEADERS pool_fileconflicts.h repo_content.h repo_deltainfoxml.h repo_helix.h repo_products.h repo_releasefile_products.h repo_repomdxml.h repo_rpmdb.h repo_rpmmd.h @@ -20,5 +17,21 @@ SET (libsolvext_HEADERS SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/ext/libsolvext.ver") +IF (DISABLE_SHARED) +ADD_LIBRARY (libsolvext STATIC ${libsolvext_SRCS}) +ELSE (DISABLE_SHARED) +ADD_LIBRARY (libsolvext SHARED ${libsolvext_SRCS}) +ENDIF (DISABLE_SHARED) + +SET_TARGET_PROPERTIES(libsolvext PROPERTIES OUTPUT_NAME "solvext") +SET_TARGET_PROPERTIES(libsolvext PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION}) + INSTALL (FILES ${libsolvext_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/solv") INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + +IF (ENABLE_STATIC AND NOT DISABLE_SHARED) +ADD_LIBRARY (libsolvext_static STATIC ${libsolvext_SRCS}) +SET_TARGET_PROPERTIES(libsolvext_static PROPERTIES OUTPUT_NAME "solvext") +SET_TARGET_PROPERTIES(libsolvext_static PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION}) +INSTALL (TARGETS libsolvext_static LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) +ENDIF (ENABLE_STATIC AND NOT DISABLE_SHARED) 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) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 18071a2..f1aac86 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -4,47 +4,52 @@ ADD_LIBRARY (toolstuff STATIC common_write.c) +# as we link with --as-needed we do not get bogus dependencies +SET (SYSTEM_LIBRARIES ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) +IF (NOT DEBIAN) +SET (SYSTEM_LIBRARIES ${RPMDB_LIBRARY} ${SYSTEM_LIBRARIES}) +ENDIF (NOT DEBIAN) + IF (NOT DEBIAN) ADD_EXECUTABLE (rpmdb2solv rpmdb2solv.c) -TARGET_LINK_LIBRARIES (rpmdb2solv toolstuff libsolvext libsolv ${RPMDB_LIBRARY} ${EXPAT_LIBRARY}) +TARGET_LINK_LIBRARIES (rpmdb2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (rpms2solv rpms2solv.c) -TARGET_LINK_LIBRARIES (rpms2solv toolstuff libsolvext libsolv ${RPMDB_LIBRARY}) +TARGET_LINK_LIBRARIES (rpms2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (findfileconflicts findfileconflicts.c) -TARGET_LINK_LIBRARIES (findfileconflicts libsolvext libsolv ${RPMDB_LIBRARY}) - +TARGET_LINK_LIBRARIES (findfileconflicts libsolvext libsolv ${SYSTEM_LIBRARIES}) ENDIF (NOT DEBIAN) ADD_EXECUTABLE (rpmmd2solv rpmmd2solv.c) -TARGET_LINK_LIBRARIES (rpmmd2solv toolstuff libsolvext libsolv ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) +TARGET_LINK_LIBRARIES (rpmmd2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (helix2solv helix2solv.c) -TARGET_LINK_LIBRARIES (helix2solv toolstuff libsolvext libsolv ${EXPAT_LIBRARY}) +TARGET_LINK_LIBRARIES (helix2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (susetags2solv susetags2solv.c) -TARGET_LINK_LIBRARIES (susetags2solv toolstuff libsolvext libsolv ${ZLIB_LIBRARY}) +TARGET_LINK_LIBRARIES (susetags2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (updateinfoxml2solv updateinfoxml2solv.c) -TARGET_LINK_LIBRARIES (updateinfoxml2solv toolstuff libsolvext libsolv ${EXPAT_LIBRARY}) +TARGET_LINK_LIBRARIES (updateinfoxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (deltainfoxml2solv deltainfoxml2solv.c) -TARGET_LINK_LIBRARIES (deltainfoxml2solv toolstuff libsolvext libsolv ${EXPAT_LIBRARY}) +TARGET_LINK_LIBRARIES (deltainfoxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (repomdxml2solv repomdxml2solv.c) -TARGET_LINK_LIBRARIES (repomdxml2solv toolstuff libsolvext libsolv ${EXPAT_LIBRARY}) +TARGET_LINK_LIBRARIES (repomdxml2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (installcheck installcheck.c) -TARGET_LINK_LIBRARIES (installcheck libsolvext libsolv ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) +TARGET_LINK_LIBRARIES (installcheck libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (patchcheck patchcheck.c) -TARGET_LINK_LIBRARIES (patchcheck libsolvext libsolv ${EXPAT_LIBRARY} ${ZLIB_LIBRARY}) +TARGET_LINK_LIBRARIES (patchcheck libsolvext libsolv ${SYSTEM_LIBRARIES}) ADD_EXECUTABLE (dumpsolv dumpsolv.c ) TARGET_LINK_LIBRARIES (dumpsolv libsolv) ADD_EXECUTABLE (mergesolv mergesolv.c ) -TARGET_LINK_LIBRARIES (mergesolv toolstuff libsolvext libsolv) +TARGET_LINK_LIBRARIES (mergesolv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES}) INSTALL (TARGETS mergesolv |