forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (67 loc) · 3.25 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
file(GLOB _SRCS "*.h" "*.cc")
set(NAME ${PROJECT_NAME}_sat)
# Will be merge in libortools.so
#add_library(${NAME} STATIC ${_SRCS})
add_library(${NAME} OBJECT ${_SRCS})
set_target_properties(${NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
)
# CMake < 3.12: CMakeError: Object library may not link to anything.
#target_link_libraries(${NAME} PRIVATE
# absl::any absl::memory absl::synchronization absl::container absl::strings absl::str_format
# gflags::gflags glog::glog
# protobuf::libprotobuf
# Coin::Cbc
# ${PROJECT_NAME}::proto)
target_include_directories(${NAME} PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
$<TARGET_PROPERTY:absl::any,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::memory,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::synchronization,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::strings,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::str_format,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:glog::glog,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
$<$<BOOL:${USE_COINOR}>:$<TARGET_PROPERTY:Coin::Cbc,INTERFACE_INCLUDE_DIRECTORIES>>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(${NAME} PRIVATE
$<TARGET_PROPERTY:absl::any,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::memory,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::synchronization,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_OPTIONS>
$<$<BOOL:${USE_COINOR}>:$<TARGET_PROPERTY:Coin::Cbc,INTERFACE_COMPILE_OPTIONS>>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_OPTIONS>
)
target_compile_definitions(${NAME} PRIVATE
$<TARGET_PROPERTY:absl::any,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::memory,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::synchronization,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>
$<$<BOOL:${USE_COINOR}>:$<TARGET_PROPERTY:Coin::Cbc,INTERFACE_COMPILE_DEFINITIONS>>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_DEFINITIONS>
)
add_dependencies(${NAME}
absl::any absl::memory absl::synchronization absl::container absl::strings absl::str_format
gflags::gflags glog::glog
protobuf::libprotobuf
${PROJECT_NAME}::proto)
if(USE_COINOR)
add_dependencies(${NAME} Coin::Cbc)
endif()
add_library(${PROJECT_NAME}::sat ALIAS ${NAME})