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

Detect gz program instead of using CMake module to check for gz-tools #172

Merged
merged 1 commit into from
Jun 25, 2022
Merged
Show file tree
Hide file tree
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
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