-
Notifications
You must be signed in to change notification settings - Fork 395
/
CMakeLists.txt
83 lines (62 loc) · 2.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(minisat)
#--------------------------------------------------------------------------------------------------
# Configurable options:
option(STATIC_BINARIES "Link binaries statically." ON)
option(USE_SORELEASE "Use SORELEASE in shared library filename." ON)
#--------------------------------------------------------------------------------------------------
# Library version:
set(MINISAT_SOMAJOR 2)
set(MINISAT_SOMINOR 1)
set(MINISAT_SORELEASE 0)
# Compute VERSION and SOVERSION:
if (USE_SORELEASE)
set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR}.${MINISAT_SORELEASE})
else()
set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR})
endif()
set(MINISAT_SOVERSION ${MINISAT_SOMAJOR})
#--------------------------------------------------------------------------------------------------
# Dependencies:
find_package(ZLIB)
include_directories(${ZLIB_INCLUDE_DIR})
include_directories(${minisat_SOURCE_DIR})
#--------------------------------------------------------------------------------------------------
# Compile flags:
add_definitions(-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS)
#--------------------------------------------------------------------------------------------------
# Build Targets:
set(MINISAT_LIB_SOURCES
minisat/utils/Options.cc
minisat/utils/System.cc
minisat/core/Solver.cc
minisat/simp/SimpSolver.cc)
add_library(minisat-lib-static STATIC ${MINISAT_LIB_SOURCES})
add_library(minisat-lib-shared SHARED ${MINISAT_LIB_SOURCES})
target_link_libraries(minisat-lib-shared ${ZLIB_LIBRARY})
target_link_libraries(minisat-lib-static ${ZLIB_LIBRARY})
add_executable(minisat_core minisat/core/Main.cc)
add_executable(minisat_simp minisat/simp/Main.cc)
if(STATIC_BINARIES)
target_link_libraries(minisat_core minisat-lib-static)
target_link_libraries(minisat_simp minisat-lib-static)
else()
target_link_libraries(minisat_core minisat-lib-shared)
target_link_libraries(minisat_simp minisat-lib-shared)
endif()
set_target_properties(minisat-lib-static PROPERTIES OUTPUT_NAME "minisat")
set_target_properties(minisat-lib-shared
PROPERTIES
OUTPUT_NAME "minisat"
VERSION ${MINISAT_VERSION}
SOVERSION ${MINISAT_SOVERSION})
set_target_properties(minisat_simp PROPERTIES OUTPUT_NAME "minisat")
#--------------------------------------------------------------------------------------------------
# Installation targets:
install(TARGETS minisat-lib-static minisat-lib-shared minisat_core minisat_simp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(DIRECTORY minisat/mtl minisat/utils minisat/core minisat/simp
DESTINATION include/minisat
FILES_MATCHING PATTERN "*.h")