Skip to content

Commit 0c75074

Browse files
committed
Simplified CMakeLists.txt
* Reusing the project name which avoids redeclaration and typos * Using include directories instead of target include directories for each target * Removed FILE GLOB because it is evil and not recommended by Kitware * Reformatted file
1 parent a56c22f commit 0c75074

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

CMakeLists.txt

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
cmake_minimum_required(VERSION 3.7)
2-
project(open-simulation-interface)
2+
3+
project(open_simulation_interface)
4+
35
find_package(Protobuf 2.6.1 REQUIRED)
4-
file(GLOB OSI_PROTO_FILES osi_*.proto)
5-
PROTOBUF_GENERATE_CPP(PROTO_SRC PROTO_HEADER ${OSI_PROTO_FILES})
6-
add_library(open_simulation_interface STATIC ${PROTO_SRC} ${PROTO_HEADER})
7-
target_include_directories(open_simulation_interface PUBLIC ${PROTOBUF_INCLUDE_DIR})
8-
target_link_libraries(open_simulation_interface PUBLIC ${PROTOBUF_LIBRARY})
9-
add_library(open_simulation_interface_pic STATIC ${PROTO_SRC} ${PROTO_HEADER})
10-
set_property(TARGET open_simulation_interface_pic PROPERTY POSITION_INDEPENDENT_CODE ON)
11-
target_include_directories(open_simulation_interface_pic PUBLIC ${PROTOBUF_INCLUDE_DIR})
12-
target_link_libraries(open_simulation_interface_pic PUBLIC ${PROTOBUF_LIBRARY})
13-
set (OSI_PROTOBUF_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "[OSI] Path to generated protobuf files for the open simulation interface.")
6+
7+
set(OSI_PROTO_FILES
8+
osi_common.proto
9+
osi_datarecording.proto
10+
osi_detectedlandmark.proto
11+
osi_detectedlane.proto
12+
osi_detectedobject.proto
13+
osi_detectedoccupant.proto
14+
osi_environment.proto
15+
osi_groundtruth.proto
16+
osi_landmark.proto
17+
osi_lane.proto
18+
osi_lowleveldata.proto
19+
osi_modelinternal.proto
20+
osi_object.proto
21+
osi_occupant.proto
22+
osi_sensordata.proto
23+
osi_sensorspecific.proto
24+
)
25+
26+
protobuf_generate_cpp(PROTO_SRCS PROTO_HEADERS ${OSI_PROTO_FILES})
27+
28+
include_directories(${PROTOBUF_INCLUDE_DIRS})
29+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
30+
31+
add_library(${PROJECT_NAME} STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
32+
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY})
33+
34+
add_library(${PROJECT_NAME}_pic STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
35+
target_link_libraries(${PROJECT_NAME}_pic PUBLIC ${PROTOBUF_LIBRARY})
36+
37+
set_property(TARGET ${PROJECT_NAME}_pic PROPERTY POSITION_INDEPENDENT_CODE ON)

0 commit comments

Comments
 (0)