Skip to content

Commit

Permalink
Place YARP-related lines in root CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Apr 13, 2018
1 parent bc4e98d commit 9c04748
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 41 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Create targets if specific requirements are satisfied.
include(CMakeDependentOption)

# Find YARP (main dependency).
find_package(YARP REQUIRED)

# Load YARP modules.
if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})
include(YarpPlugin)
include(YarpInstallationHelpers)
endif()

# Configure installation paths for YARP resources.
yarp_configure_external_installation(rd)

# Add main contents.
add_subdirectory(share)
add_subdirectory(src)
Expand Down
5 changes: 0 additions & 5 deletions share/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})
include(YarpInstallationHelpers)
yarp_configure_external_installation(rd)

### Go through directories

add_subdirectory(robotDevastation)
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/ImageLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)
find_package(ZBar REQUIRED)

add_library(ImageLib ImageEventListener.hpp
Expand All @@ -22,9 +21,12 @@ add_library(ImageLib ImageEventListener.hpp
add_dependencies(ImageLib COLOR_DEBUG)

target_include_directories(ImageLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS}
${ZBAR_INCLUDE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(ImageLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(ImageLib PUBLIC YARP::YARP_OS
YARP::YARP_dev
YARP::YARP_sig
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/MusicLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)

Expand All @@ -16,10 +15,13 @@ add_library(MusicLib AudioManager.hpp
add_dependencies(MusicLib COLOR_DEBUG)

target_include_directories(MusicLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${SDL2_MIXER_INCLUDE_DIRS})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(MusicLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(MusicLib PUBLIC YARP::YARP_OS
${SDL2_LIBRARY}
${SDL2_MIXER_LIBRARIES})
10 changes: 6 additions & 4 deletions src/libraries/NetworkLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

add_library(NetworkLib MockNetworkEventListener.hpp
MockNetworkEventListener.cpp
MockNetworkManager.hpp
Expand All @@ -16,8 +14,12 @@ add_library(NetworkLib MockNetworkEventListener.hpp

add_dependencies(NetworkLib COLOR_DEBUG)

target_include_directories(NetworkLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS})
target_include_directories(NetworkLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(NetworkLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()


target_link_libraries(NetworkLib PUBLIC YARP::YARP_OS
MentalMapLib)
Expand Down
9 changes: 5 additions & 4 deletions src/libraries/RobotLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

add_library(RobotLib MockRobotManager.cpp
MockRobotManager.hpp)

add_dependencies(RobotLib COLOR_DEBUG ASROB_YARP_DEVICES)

target_include_directories(RobotLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS})
target_include_directories(RobotLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(RobotLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(RobotLib PUBLIC ASROB::RobotInterfaces)
9 changes: 5 additions & 4 deletions src/libraries/ServerLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

add_library(ServerLib RpcResponder.hpp
RpcResponder.cpp
Server.hpp
Server.cpp)

add_dependencies(ServerLib COLOR_DEBUG)

target_include_directories(ServerLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS})
target_include_directories(ServerLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(ServerLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(ServerLib PUBLIC YARP::YARP_OS
MentalMapLib)
Expand Down
9 changes: 5 additions & 4 deletions src/libraries/StateMachineLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

add_library(StateMachineLib MockState.hpp
MockState.cpp
State.hpp
Expand All @@ -19,7 +17,10 @@ add_library(StateMachineLib MockState.hpp

add_dependencies(StateMachineLib COLOR_DEBUG)

target_include_directories(StateMachineLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS})
target_include_directories(StateMachineLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(StateMachineLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(StateMachineLib PUBLIC YARP::YARP_OS)
7 changes: 4 additions & 3 deletions src/libraries/UserInterfaceLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
Expand All @@ -26,10 +24,13 @@ add_library(UserInterfaceLib DeadScreen.hpp
add_dependencies(UserInterfaceLib COLOR_DEBUG)

target_include_directories(UserInterfaceLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIRS})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(UserInterfaceLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_include_directories(UserInterfaceLib PRIVATE ${SDL2_IMAGE_INCLUDE_DIRS})

target_link_libraries(UserInterfaceLib PUBLIC YARP::YARP_OS
Expand Down
7 changes: 4 additions & 3 deletions src/libraries/UtilsLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
# URL: https://github.com/asrob-uc3m/robotDevastation

find_package(YARP REQUIRED)

find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
Expand All @@ -18,9 +16,12 @@ add_library(UtilsLib Hub.hpp
add_dependencies(UtilsLib COLOR_DEBUG ASROB_YARP_DEVICES)

target_include_directories(UtilsLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(UtilsLib PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_include_directories(UtilsLib PRIVATE ${SDL2_IMAGE_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIR})

Expand Down
7 changes: 3 additions & 4 deletions src/programs/rdServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ option(ENABLE_rdServer "Choose if you want to compile rdServer" ON)

if(ENABLE_rdServer)

# Find YARP. Point the YARP_DIR environment variable at your build.
find_package(YARP REQUIRED)

# Set up our main executable.
add_executable(rdServer main.cpp)

add_dependencies(rdServer COLOR_DEBUG)

target_include_directories(rdServer PUBLIC ${YARP_INCLUDE_DIRS})
if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(rdServer PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(rdServer YARP::YARP_init
YARP::YARP_OS
Expand Down
10 changes: 5 additions & 5 deletions src/programs/robotDevastation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ option(ENABLE_robotDevastation "Choose if you want to compile robotDevastation"

if(ENABLE_robotDevastation)

# Find YARP. Point the YARP_DIR environment variable at your build.
find_package(YARP REQUIRED)

add_executable(robotDevastation main.cpp
RobotDevastation.hpp
RobotDevastation.cpp)

add_dependencies(robotDevastation COLOR_DEBUG ASROB_YARP_DEVICES)

target_include_directories(robotDevastation PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${YARP_INCLUDE_DIRS})
target_include_directories(robotDevastation PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(YARP_VERSION_SHORT VERSION_LESS 2.3.70)
target_include_directories(robotDevastation PUBLIC ${YARP_INCLUDE_DIRS})
endif()

target_link_libraries(robotDevastation YARP::YARP_OS
MusicLib
Expand Down
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if(ENABLE_tests)
set(gtest_force_shared_crt ON CACHE INTERNAL "") # needed for Windows
add_subdirectory(${GTestSources_SOURCE_DIR} ${CMAKE_BINARY_DIR}/gtest)

find_package(YARP REQUIRED)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
Expand Down

0 comments on commit 9c04748

Please sign in to comment.