Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through c++ build flags #4

Merged
merged 2 commits into from
Mar 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ project(console_bridge_vendor)

find_package(ament_cmake REQUIRED)

option(FORCE_BUILD_VENDOR_PKG
"Build console_bridge from source, even if system-installed package is available"
OFF)

if(NOT FORCE_BUILD_VENDOR_PKG)
find_package(console_bridge QUIET)
endif()

macro(build_console_bridge)
set(extra_cmake_args)
if(DEFINED CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -34,7 +42,12 @@ macro(build_console_bridge)
list(APPEND extra_cmake_args "-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME}")
endif()
endif()
else()
list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

include(ExternalProject)
# Get console_bridge 0.4.1
ExternalProject_Add(console_bridge-0.4.1
Expand All @@ -56,8 +69,6 @@ macro(build_console_bridge)
)
endmacro()

find_package(console_bridge QUIET)

if(NOT console_bridge_FOUND OR "${console_bridge_VERSION}" VERSION_LESS 0.4.1)
build_console_bridge()
endif()
Expand Down