Skip to content

Commit

Permalink
Detect gz program instead of using CMake module to check for gz-tools (
Browse files Browse the repository at this point in the history
…#172)

Signed-off-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
chapulina authored Jun 25, 2022
1 parent 184b285 commit ec5244d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ gz_find_package(ignition-plugin2 REQUIRED_BY launch COMPONENTS loader register)
set(IGN_PLUGIN_MAJOR_VER ${ignition-plugin2_VERSION_MAJOR})

#--------------------------------------
# Find ignition-tools
gz_find_package(ignition-tools2
REQUIRED
PKGCONFIG "ignition-tools")
# Find if gz command is available
find_program(GZ_TOOLS_PROGRAM gz)
if (GZ_TOOLS_PROGRAM)
message (STATUS "Searching for gz program - found. CLI tests can be built.")
else()
message (STATUS "Searching for gz program - not found. CLI tests are skipped.")
endif()

#--------------------------------------
# Find ignition-transport
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# "gtest_sources" variable.
gz_get_libsources_and_unittests(sources gtest_sources)

# Disable tests that need CLI if gz-tools is not found
if (MSVC OR NOT GZ_TOOLS_PROGRAM)
list(REMOVE_ITEM gtest_sources gz_TEST.cc)
endif()

add_library(gz STATIC gz.cc)
target_include_directories(gz PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(gz PUBLIC
Expand Down

0 comments on commit ec5244d

Please sign in to comment.