|
11 | 11 | # This script creates the following variables:
|
12 | 12 | # RTT_PLUGIN_<COMPONENT>_FOUND: Boolean that indicates if the plugin was found
|
13 | 13 | # RTT_PLUGIN_<COMPONENT>_INCLUDE_DIRS: Path to the plugin header files (equal to OROCOS_RTT_INCLUDE_DIRS)
|
14 |
| -# RTT_PLUGIN_<COMPONENT>_LIBRARIES: Plugin library |
| 14 | +# RTT_PLUGIN_<COMPONENT>_LIBRARIES: Plugin library for the current OROCOS_TARGET cmake or environment variable. |
| 15 | +# RTT_PLUGIN_<COMPONENT>_<OROCOS_TARGET>_LIBRARIES: Plugin library for the current OROCOS_TARGET cmake or environment variable (same as above). |
15 | 16 | #
|
16 | 17 | ################################################################################
|
17 | 18 |
|
18 | 19 | include(LibFindMacros)
|
19 | 20 |
|
20 |
| -find_package(Orocos-RTT REQUIRED ${RTT_HINTS}) |
| 21 | +find_package(OROCOS-RTT REQUIRED ${RTT_HINTS}) |
21 | 22 |
|
22 | 23 | FOREACH(COMPONENT ${RTTPlugin_FIND_COMPONENTS})
|
23 | 24 | # We search for both 'given name' and 'given name + -target'
|
24 | 25 | set(PLUGIN_NAME ${COMPONENT} ${COMPONENT}-${OROCOS_TARGET} )
|
25 | 26 | #STRING(TOUPPER ${COMPONENT} COMPONENT)
|
26 | 27 |
|
27 | 28 | set(RTT_PLUGIN_${COMPONENT}_INCLUDE_DIR ${OROCOS-RTT_INCLUDE_DIRS} )
|
| 29 | + set(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_INCLUDE_DIR ${OROCOS-RTT_INCLUDE_DIRS} ) |
28 | 30 | # Find plugins
|
29 | 31 | if(OROCOS-RTT_PLUGIN_PATH)
|
30 | 32 | # Use location specified by environment variable
|
31 | 33 | find_library(RTT_PLUGIN_${COMPONENT}_LIBRARY NAMES ${PLUGIN_NAME} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET} NO_DEFAULT_PATH)
|
32 | 34 | find_library(RTT_PLUGIN_${COMPONENT}D_LIBRARY NAMES ${PLUGIN_NAME}${CMAKE_DEBUG_POSTFIX} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET} NO_DEFAULT_PATH)
|
| 35 | + find_library(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY NAMES ${PLUGIN_NAME} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET} NO_DEFAULT_PATH) |
| 36 | + find_library(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY NAMES ${PLUGIN_NAME}${CMAKE_DEBUG_POSTFIX} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET} NO_DEFAULT_PATH) |
33 | 37 | else()
|
34 | 38 | # Use default CMake search process
|
35 | 39 | find_library(RTT_PLUGIN_${COMPONENT}_LIBRARY NAMES ${PLUGIN_NAME} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET})
|
36 | 40 | find_library(RTT_PLUGIN_${COMPONENT}D_LIBRARY NAMES ${PLUGIN_NAME}${CMAKE_DEBUG_POSTFIX} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET})
|
| 41 | + find_library(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY NAMES ${PLUGIN_NAME} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET}) |
| 42 | + find_library(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY NAMES ${PLUGIN_NAME}${CMAKE_DEBUG_POSTFIX} PATHS ${OROCOS-RTT_PLUGIN_PATH} PATH_SUFFIXES ${OROCOS_TARGET}) |
37 | 43 | endif()
|
38 | 44 |
|
39 | 45 | # Set the include dir variables and the libraries and let libfind_process do the rest.
|
40 | 46 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
|
41 | 47 | set(RTT_PLUGIN_${COMPONENT}_PROCESS_INCLUDES RTT_PLUGIN_${COMPONENT}_INCLUDE_DIR )
|
42 |
| - if ( RTT_PLUGIN_${COMPONENT}D_LIBRARY ) |
43 |
| - list(APPEND RTT_PLUGIN_${COMPONENT}_PROCESS_LIBS RTT_PLUGIN_${COMPONENT}D_LIBRARY) |
| 48 | + if ( RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY ) |
| 49 | + list(APPEND RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_PROCESS_LIBS RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY) |
44 | 50 | endif()
|
45 |
| - if ( RTT_PLUGIN_${COMPONENT}_LIBRARY ) |
46 |
| - list(APPEND RTT_PLUGIN_${COMPONENT}_PROCESS_LIBS RTT_PLUGIN_${COMPONENT}_LIBRARY) |
| 51 | + if ( RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY ) |
| 52 | + list(APPEND RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_PROCESS_LIBS RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY) |
47 | 53 | endif()
|
48 | 54 |
|
49 |
| - libfind_process( RTT_PLUGIN_${COMPONENT} ) |
| 55 | + # Forward FIND_REQUIRED |
| 56 | + if(RTTPlugin_FIND_REQUIRED) |
| 57 | + set(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_FIND_REQUIRED TRUE) |
| 58 | + endif() |
| 59 | + |
| 60 | + # Forward FIND_QUIET |
| 61 | + if(RTTPlugin_FIND_QUIET) |
| 62 | + set(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_FIND_QUIET TRUE) |
| 63 | + endif() |
50 | 64 |
|
51 |
| -ENDFOREACH(COMPONENT) |
| 65 | + libfind_process( RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET} ) |
52 | 66 |
|
| 67 | + # Since libfind_process does not deal correctly with "optimized" and "debug" keywords, |
| 68 | + # we have to manualy add them thereafter |
| 69 | + if(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY AND RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY) |
| 70 | + set(RTT_PLUGIN_${COMPONENT}_LIBRARIES |
| 71 | + debug ${RTT_PLUGIN_${COMPONENT}D_LIBRARY} |
| 72 | + optimized ${RTT_PLUGIN_${COMPONENT}_LIBRARY}) |
| 73 | + set(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARIES |
| 74 | + debug ${RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}D_LIBRARY} |
| 75 | + optimized ${RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARY}) |
| 76 | + else() |
| 77 | + set(RTT_PLUGIN_${COMPONENT}_LIBRARIES "") |
| 78 | + set(RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARIES "") |
| 79 | + endif() |
| 80 | + |
| 81 | + if ( NOT "RTT_PLUGIN_${COMPONENT}_LIBRARIES" STREQUAL "RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARIES" ) |
| 82 | + # Avoid worst case and disable the generic case: |
| 83 | + message("[FindRTTPlugin] Forcing RTT_PLUGIN_${COMPONENT}_LIBRARIES to ${OROCOS_TARGET} since your are switching OROCOS_TARGETs") |
| 84 | + set( RTT_PLUGIN_${COMPONENT}_LIBRARIES ${RTT_PLUGIN_${COMPONENT}_${OROCOS_TARGET}_LIBRARIES}) |
| 85 | + endif() |
| 86 | +ENDFOREACH(COMPONENT) |
0 commit comments