forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
52 lines (51 loc) · 2.3 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
file(GLOB _SRCS "*.h" "*.cc")
set(NAME ${PROJECT_NAME}_bop)
# 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::memory absl::synchronization absl::str_format
# gflags::gflags glog::glog
# protobuf::libprotobuf
# ${PROJECT_NAME}::proto)
target_include_directories(${NAME} PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
$<TARGET_PROPERTY:absl::memory,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:absl::synchronization,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>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(${NAME} PRIVATE
$<TARGET_PROPERTY:absl::memory,INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:absl::synchronization,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>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_OPTIONS>
)
target_compile_definitions(${NAME} PRIVATE
$<TARGET_PROPERTY:absl::memory,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:absl::synchronization,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>
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_DEFINITIONS>
)
add_dependencies(${NAME}
absl::memory absl::synchronization absl::str_format
gflags::gflags glog::glog
protobuf::libprotobuf
${PROJECT_NAME}::proto)
add_library(${PROJECT_NAME}::bop ALIAS ${NAME})