diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 6aee66c02..3ae8d19c6 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -88,8 +88,10 @@ ignition-tools.") endif() if (ignition-tools_FOUND) set (HAVE_IGN_TOOLS TRUE) - set (IGN_TOOLS_VER 1) endif() +# Note that CLI files are installed regardless of whether the dependency is +# available during build time +set (IGN_TOOLS_VER 1) ################################################ # Find the Python interpreter for running the @@ -132,7 +134,7 @@ endmacro() ######################################## # Find ignition cmake2 -# Only for using the testing macros and creating the codecheck target, not +# Only for using the testing macros and creating the codecheck target, not # really being use to configure the whole project find_package(ignition-cmake2 REQUIRED) set(IGN_CMAKE_VER ${ignition-cmake2_VERSION_MAJOR}) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 5f1eca389..0cb4ae6ef 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -50,10 +50,8 @@ install(FILES ${cmd_script_generated} DESTINATION lib/ruby/ignition) configure_file( "sdf.bash_completion.sh" "${CMAKE_CURRENT_BINARY_DIR}/sdf${PROJECT_VERSION_MAJOR}.bash_completion.sh" @ONLY) -if (HAVE_IGN_TOOLS) - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/sdf${PROJECT_VERSION_MAJOR}.bash_completion.sh - DESTINATION - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${IGN_TOOLS_VER}.completion.d) -endif() +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/sdf${PROJECT_VERSION_MAJOR}.bash_completion.sh + DESTINATION + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${IGN_TOOLS_VER}.completion.d) diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index 262e7a840..6b5a452e4 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -15,13 +15,13 @@ * */ -#include #include #include #include #include #include +#include "sdf/Filesystem.hh" #include "sdf/parser.hh" #include "sdf/SDFImpl.hh" #include "sdf/sdf_config.h" @@ -825,12 +825,13 @@ TEST(HelpVsCompletionFlags, SDF) std::string helpOutput = custom_exec_str(IgnCommand() + " sdf --help"); // Call the output function in the bash completion script - std::filesystem::path scriptPath = PROJECT_SOURCE_PATH; - scriptPath = scriptPath / "src" / "cmd" / "sdf.bash_completion.sh"; + std::string scriptPath = PROJECT_SOURCE_PATH; + scriptPath = sdf::filesystem::append(scriptPath, "src", "cmd", + "sdf.bash_completion.sh"); // Equivalent to: // sh -c "bash -c \". /path/to/sdf.bash_completion.sh; _gz_sdf_flags\"" - std::string cmd = "bash -c \". " + scriptPath.string() + + std::string cmd = "bash -c \". " + scriptPath + "; _gz_sdf_flags\""; std::string scriptOutput = custom_exec_str(cmd); @@ -842,7 +843,7 @@ TEST(HelpVsCompletionFlags, SDF) EXPECT_GT(flags.size(), 0u); // Match each flag in script output with help message - for (std::string flag : flags) + for (const auto &flag : flags) { EXPECT_NE(std::string::npos, helpOutput.find(flag)) << helpOutput; }