Imported Upstream version 0.7.27
[platform/upstream/libsolv.git] / src / CMakeLists.txt
1
2 INCLUDE (CheckFunctionExists)
3 CHECK_FUNCTION_EXISTS (qsort_r HAVE_QSORT_R)
4 CHECK_FUNCTION_EXISTS (__qsort_r HAVE___QSORT_R)
5
6 IF (HAVE_QSORT_R)
7   ADD_DEFINITIONS (-DHAVE_QSORT_R=1)
8 ENDIF (HAVE_QSORT_R)
9
10 IF (HAVE___QSORT_R)
11   ADD_DEFINITIONS (-DHAVE___QSORT_R=1)
12 ENDIF (HAVE___QSORT_R)
13
14 ADD_DEFINITIONS (-DLIBSOLV_INTERNAL=1)
15
16 SET (libsolv_SRCS
17     bitmap.c poolarch.c poolvendor.c poolid.c strpool.c dirpool.c
18     solver.c solverdebug.c repo_solv.c repo_write.c evr.c pool.c
19     queue.c repo.c repodata.c repopage.c util.c policy.c solvable.c
20     transaction.c order.c rules.c problems.c linkedpkg.c cplxdeps.c
21     chksum.c md5.c sha1.c sha2.c solvversion.c selection.c
22     fileprovides.c diskusage.c suse.c solver_util.c cleandeps.c
23     userinstalled.c filelistfilter.c decision.c)
24
25 SET (libsolv_HEADERS
26     bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h
27     poolid.h pooltypes.h queue.h solvable.h solver.h solverdebug.h
28     repo.h repodata.h repo_solv.h repo_write.h util.h selection.h
29     strpool.h dirpool.h knownid.h transaction.h rules.h problems.h
30     chksum.h dataiterator.h ${CMAKE_BINARY_DIR}/src/solvversion.h)
31
32 IF (ENABLE_CONDA)
33     SET (libsolv_SRCS ${libsolv_SRCS} conda.c)
34     SET (libsolv_HEADERS ${libsolv_HEADERS} conda.h)
35 ENDIF (ENABLE_CONDA)
36
37 IF (NOT MSVC)
38     SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
39 ENDIF (NOT MSVC)
40
41 IF (WIN32)
42     INCLUDE (${PROJECT_SOURCE_DIR}/win32/CMakeLists.txt)
43     LIST (APPEND libsolv_SRCS ${WIN32_COMPAT_SOURCES})
44 ENDIF (WIN32)
45
46 IF (HAVE_LINKER_VERSION_SCRIPT)
47 SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver")
48 ENDIF (HAVE_LINKER_VERSION_SCRIPT)
49
50 IF (DISABLE_SHARED)
51     ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
52 ELSE (DISABLE_SHARED)
53     ADD_LIBRARY (libsolv SHARED ${libsolv_SRCS})
54 ENDIF (DISABLE_SHARED)
55
56 IF (WIN32)
57     IF (DISABLE_SHARED)
58         TARGET_COMPILE_DEFINITIONS(libsolv PUBLIC SOLV_STATIC_LIB)
59     ELSE (DISABLE_SHARED)
60         TARGET_COMPILE_DEFINITIONS(libsolv PRIVATE SOLV_EXPORTS)
61     ENDIF (DISABLE_SHARED)
62 ENDIF (WIN32)
63
64 SET_TARGET_PROPERTIES(libsolv PROPERTIES OUTPUT_NAME "solv")
65 SET_TARGET_PROPERTIES(libsolv PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
66
67 INSTALL (FILES ${libsolv_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/solv")
68 INSTALL (TARGETS libsolv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
69
70 IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
71 ADD_LIBRARY (libsolv_static STATIC ${libsolv_SRCS})
72 SET_TARGET_PROPERTIES(libsolv_static PROPERTIES OUTPUT_NAME "solv")
73 SET_TARGET_PROPERTIES(libsolv_static PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
74 INSTALL (TARGETS libsolv_static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
75 ENDIF (ENABLE_STATIC AND NOT DISABLE_SHARED)