Project

General

Profile

CMakeLists.txt

n-miyamoto, 01/16/2019 07:42 AM

 
1
set(comp_srcs testcpp.cpp )
2
set(standalone_srcs testcppComp.cpp)
3

    
4

    
5
if(${OPENRTM_VERSION_MAJOR} LESS 2)
6
  set(OPENRTM_CFLAGS ${OPENRTM_CFLAGS} ${OMNIORB_CFLAGS})
7
  set(OPENRTM_INCLUDE_DIRS ${OPENRTM_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIRS})
8
  set(OPENRTM_LIBRARY_DIRS ${OPENRTM_LIBRARY_DIRS} ${OMNIORB_LIBRARY_DIRS})
9
endif()
10

    
11
if (DEFINED OPENRTM_INCLUDE_DIRS)
12
  string(REGEX REPLACE "-I" ";"
13
    OPENRTM_INCLUDE_DIRS "${OPENRTM_INCLUDE_DIRS}")
14
  string(REGEX REPLACE " ;" ";"
15
    OPENRTM_INCLUDE_DIRS "${OPENRTM_INCLUDE_DIRS}")
16
endif (DEFINED OPENRTM_INCLUDE_DIRS)
17

    
18
if (DEFINED OPENRTM_LIBRARY_DIRS)
19
  string(REGEX REPLACE "-L" ";"
20
    OPENRTM_LIBRARY_DIRS "${OPENRTM_LIBRARY_DIRS}")
21
  string(REGEX REPLACE " ;" ";"
22
    OPENRTM_LIBRARY_DIRS "${OPENRTM_LIBRARY_DIRS}")
23
endif (DEFINED OPENRTM_LIBRARY_DIRS)
24

    
25
if (DEFINED OPENRTM_LIBRARIES)
26
  string(REGEX REPLACE "-l" ";"
27
    OPENRTM_LIBRARIES "${OPENRTM_LIBRARIES}")
28
  string(REGEX REPLACE " ;" ";"
29
    OPENRTM_LIBRARIES "${OPENRTM_LIBRARIES}")
30
endif (DEFINED OPENRTM_LIBRARIES)
31

    
32
include_directories(${PROJECT_SOURCE_DIR}/include)
33
include_directories(${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME})
34
include_directories(${PROJECT_BINARY_DIR})
35
include_directories(${PROJECT_BINARY_DIR}/idl)
36
include_directories(${OPENRTM_INCLUDE_DIRS})
37
add_definitions(${OPENRTM_CFLAGS})
38

    
39

    
40
MAP_ADD_STR(comp_hdrs "../" comp_headers)
41

    
42
link_directories(${OPENRTM_LIBRARY_DIRS})
43

    
44

    
45
add_library(${PROJECT_NAME} ${LIB_TYPE} ${comp_srcs}
46
  ${comp_headers} ${ALL_IDL_SRCS})
47
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
48
set_source_files_properties(${ALL_IDL_SRCS} PROPERTIES GENERATED 1)
49
if(NOT TARGET ALL_IDL_TGT)
50
 add_custom_target(ALL_IDL_TGT)
51
endif(NOT TARGET ALL_IDL_TGT)
52
add_dependencies(${PROJECT_NAME} ALL_IDL_TGT)
53
target_link_libraries(${PROJECT_NAME} ${OPENRTM_LIBRARIES})
54

    
55
add_executable(${PROJECT_NAME}Comp ${standalone_srcs}
56
  ${comp_srcs} ${comp_headers} ${ALL_IDL_SRCS})
57
add_dependencies(${PROJECT_NAME}Comp ALL_IDL_TGT)
58
target_link_libraries(${PROJECT_NAME}Comp ${OPENRTM_LIBRARIES})
59

    
60
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}Comp
61
    EXPORT ${PROJECT_NAME}
62
    RUNTIME DESTINATION ${INSTALL_PREFIX} COMPONENT component
63
    LIBRARY DESTINATION ${INSTALL_PREFIX} COMPONENT component
64
    ARCHIVE DESTINATION ${INSTALL_PREFIX} COMPONENT component)
65

    
66
install(FILES ${PROJECT_SOURCE_DIR}/RTC.xml DESTINATION ${INSTALL_PREFIX}
67
        COMPONENT component)