From f18b240bbec3ebeebba83cf1ee95d2dd47126519 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Sat, 30 Apr 2022 02:11:59 -0400 Subject: [PATCH 01/16] bash completion for flags Signed-off-by: Mabel Zhang --- plugin.bash_completion.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plugin.bash_completion.sh diff --git a/plugin.bash_completion.sh b/plugin.bash_completion.sh new file mode 100644 index 00000000..033af099 --- /dev/null +++ b/plugin.bash_completion.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# bash tab-completion + +# This is a per-library function definition, used in conjunction with the +# top-level entry point in ign-tools. + +function _ign_plugin +{ + if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]]; then + # Specify options (-*) word list for this subcommand + COMPREPLY=($(compgen -W " + -h --help + --help-all + --version + -v --verbose + -i --info + -p --plugin + " -- "${COMP_WORDS[COMP_CWORD]}" )) + return + else + # Just use bash default auto-complete, because we never have two + # subcommands in the same line. If that is ever needed, change here to + # detect subsequent subcommands + COMPREPLY=($(compgen -o default -- "${COMP_WORDS[COMP_CWORD]}")) + return + fi +} From 5da98783e8694aad772095355b11f2b01b3af26a Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Sat, 30 Apr 2022 02:47:51 -0400 Subject: [PATCH 02/16] rename functions ign->gz Signed-off-by: Mabel Zhang --- plugin.bash_completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.bash_completion.sh b/plugin.bash_completion.sh index 033af099..9462a003 100644 --- a/plugin.bash_completion.sh +++ b/plugin.bash_completion.sh @@ -5,7 +5,7 @@ # This is a per-library function definition, used in conjunction with the # top-level entry point in ign-tools. -function _ign_plugin +function _gz_plugin { if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]]; then # Specify options (-*) word list for this subcommand From 634c8bd859cd5a18fc074b911533a5152f2dd679 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 3 May 2022 04:18:29 -0400 Subject: [PATCH 03/16] add installation Signed-off-by: Mabel Zhang --- CMakeLists.txt | 1 + cmd/CMakeLists.txt | 2 ++ plugin.bash_completion.sh => cmd/plugin.bash_completion.sh | 0 3 files changed, 3 insertions(+) create mode 100644 cmd/CMakeLists.txt rename plugin.bash_completion.sh => cmd/plugin.bash_completion.sh (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cbf89f6..f5d6a25b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,3 +63,4 @@ ign_create_docs( TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md" ) +add_subdirectory(cmd) diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt new file mode 100644 index 00000000..e1b4636c --- /dev/null +++ b/cmd/CMakeLists.txt @@ -0,0 +1,2 @@ +# Install the bash completion script in an unversioned location. +install(FILES plugin.bash_completion.sh DESTINATION share/ignition/ignition.completion.d) diff --git a/plugin.bash_completion.sh b/cmd/plugin.bash_completion.sh similarity index 100% rename from plugin.bash_completion.sh rename to cmd/plugin.bash_completion.sh From 3f84528404f8965b3c7d552734134318ea77096d Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 10 May 2022 23:39:57 -0400 Subject: [PATCH 04/16] ign->gz; move file Signed-off-by: Mabel Zhang --- cmd/CMakeLists.txt | 2 -- {cmd => loader/conf}/plugin.bash_completion.sh | 0 2 files changed, 2 deletions(-) delete mode 100644 cmd/CMakeLists.txt rename {cmd => loader/conf}/plugin.bash_completion.sh (100%) diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt deleted file mode 100644 index e1b4636c..00000000 --- a/cmd/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Install the bash completion script in an unversioned location. -install(FILES plugin.bash_completion.sh DESTINATION share/ignition/ignition.completion.d) diff --git a/cmd/plugin.bash_completion.sh b/loader/conf/plugin.bash_completion.sh similarity index 100% rename from cmd/plugin.bash_completion.sh rename to loader/conf/plugin.bash_completion.sh From b078cd1cc7ca6b61c141c20fa12f74281321a910 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 11 May 2022 01:51:31 -0400 Subject: [PATCH 05/16] forgot to add files Signed-off-by: Mabel Zhang --- CMakeLists.txt | 2 -- loader/conf/CMakeLists.txt | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5d6a25b..1a11ac8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,5 +62,3 @@ ign_create_docs( API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md" TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md" ) - -add_subdirectory(cmd) diff --git a/loader/conf/CMakeLists.txt b/loader/conf/CMakeLists.txt index fefd7c34..03824432 100644 --- a/loader/conf/CMakeLists.txt +++ b/loader/conf/CMakeLists.txt @@ -25,3 +25,7 @@ configure_file( # Install the yaml configuration files in an unversioned location. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/) + +# Install the bash completion script in an unversioned location. +install(FILES plugin.bash_completion.sh + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz.completion.d/) From d5db3f9a8f0b2841ccc79179c7c187750cd4e3a7 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 11 May 2022 01:51:55 -0400 Subject: [PATCH 06/16] add test comparing flags between defined and bash completion Signed-off-by: Mabel Zhang --- loader/src/ign_TEST.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index e5036537..fd48a277 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -16,6 +16,7 @@ */ #include +#include #include #include "gtest/gtest.h" @@ -183,3 +184,29 @@ TEST(ignTest, PluginInfoVerboseDummyPlugins) output.find("There are 2 aliases with a name collision")) << output; } + +////////////////////////////////////////////////// +/// \brief Check --help message and bash completion script for consistent flags +TEST(ignTest, PluginHelpVsCompletionFlags) +{ + // Path to ign executable + std::string ign = std::string(IGN_PATH); + + // Flags in help message + std::string output = custom_exec_str(ign + " plugin --help"); + EXPECT_NE(std::string::npos, output.find("-i [ --info ]")) << output; + EXPECT_NE(std::string::npos, output.find("-p [ --plugin ]")) << output; + EXPECT_NE(std::string::npos, output.find("-v [ --verbose ]")) << output; + EXPECT_NE(std::string::npos, output.find("-h [ --help ]")) << output; + + // Flags in bash completion + std::ifstream scriptFile(std::string(IGN_PLUGIN_SOURCE_DIR) + + "/loader/conf/plugin.bash_completion.sh"); + std::string script((std::istreambuf_iterator(scriptFile)), + std::istreambuf_iterator()); + + EXPECT_NE(std::string::npos, script.find("--info")) << script; + EXPECT_NE(std::string::npos, script.find("--plugin")) << script; + EXPECT_NE(std::string::npos, script.find("--verbose")) << script; + EXPECT_NE(std::string::npos, script.find("--help")) << script; +} From bfa50012780604b05acfe7b1f9643aed3f65d972 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 11 May 2022 01:53:05 -0400 Subject: [PATCH 07/16] remove diff Signed-off-by: Mabel Zhang --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a11ac8e..0cbf89f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,3 +62,4 @@ ign_create_docs( API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md" TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md" ) + From 1b219727e497d8efe2459b199da6cdab8d131c30 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 11 May 2022 02:00:47 -0400 Subject: [PATCH 08/16] relax test for plugin2 Signed-off-by: Mabel Zhang --- loader/src/ign_TEST.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index fd48a277..7d2d7c1e 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -194,10 +194,10 @@ TEST(ignTest, PluginHelpVsCompletionFlags) // Flags in help message std::string output = custom_exec_str(ign + " plugin --help"); - EXPECT_NE(std::string::npos, output.find("-i [ --info ]")) << output; - EXPECT_NE(std::string::npos, output.find("-p [ --plugin ]")) << output; - EXPECT_NE(std::string::npos, output.find("-v [ --verbose ]")) << output; - EXPECT_NE(std::string::npos, output.find("-h [ --help ]")) << output; + EXPECT_NE(std::string::npos, output.find("--info")) << output; + EXPECT_NE(std::string::npos, output.find("--plugin")) << output; + EXPECT_NE(std::string::npos, output.find("--verbose")) << output; + EXPECT_NE(std::string::npos, output.find("--help")) << output; // Flags in bash completion std::ifstream scriptFile(std::string(IGN_PLUGIN_SOURCE_DIR) + From c3bf48d749423e33fe4e684ec757991f786c6776 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 11 May 2022 02:21:44 -0400 Subject: [PATCH 09/16] alpha Signed-off-by: Mabel Zhang --- loader/src/ign_TEST.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index 7d2d7c1e..cded7430 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -15,8 +15,8 @@ * */ -#include #include +#include #include #include "gtest/gtest.h" From f93b59d396a4d295b357abf007ea6050f65a4ba1 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Thu, 19 May 2022 22:08:39 -0400 Subject: [PATCH 10/16] install to versioned place Signed-off-by: Mabel Zhang --- CMakeLists.txt | 3 +++ loader/conf/CMakeLists.txt | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cbf89f6..d23c8d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,9 @@ ign_find_package(DL #-------------------------------------- # Find ignition-tools find_program(IGN_TOOLS_PROGRAM ign) +if (IGN_TOOLS_PROGRAM) + set(IGN_TOOLS_VER 1) +endif() #============================================================================ diff --git a/loader/conf/CMakeLists.txt b/loader/conf/CMakeLists.txt index 03824432..39c5c1d6 100644 --- a/loader/conf/CMakeLists.txt +++ b/loader/conf/CMakeLists.txt @@ -26,6 +26,14 @@ configure_file( install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/) -# Install the bash completion script in an unversioned location. -install(FILES plugin.bash_completion.sh - DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz.completion.d/) +# Tack version onto and install the bash completion script +configure_file( + "plugin.bash_completion.sh" + "${CMAKE_CURRENT_BINARY_DIR}/plugin${PROJECT_VERSION_MAJOR}.bash_completion.sh" @ONLY) +if (IGN_TOOLS_PROGRAM) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/plugin${PROJECT_VERSION_MAJOR}.bash_completion.sh + DESTINATION + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${IGN_TOOLS_VER}.completion.d) +endif() From 69c69e4bcd6145512cf3885fff09525c0398e405 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 00:32:38 -0400 Subject: [PATCH 11/16] license Signed-off-by: Mabel Zhang --- loader/conf/plugin.bash_completion.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/loader/conf/plugin.bash_completion.sh b/loader/conf/plugin.bash_completion.sh index 9462a003..ce77e22f 100644 --- a/loader/conf/plugin.bash_completion.sh +++ b/loader/conf/plugin.bash_completion.sh @@ -1,4 +1,19 @@ #!/usr/bin/env bash +# +# Copyright (C) 2022 Open Source Robotics Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # bash tab-completion From c40c333a9eede2eee17a36fb2c753ce07a2e15e8 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 18:49:25 -0400 Subject: [PATCH 12/16] use std path Signed-off-by: Mabel Zhang --- loader/src/ign_TEST.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index cded7430..2330e2d7 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -15,6 +15,7 @@ * */ +#include #include #include #include @@ -200,8 +201,10 @@ TEST(ignTest, PluginHelpVsCompletionFlags) EXPECT_NE(std::string::npos, output.find("--help")) << output; // Flags in bash completion - std::ifstream scriptFile(std::string(IGN_PLUGIN_SOURCE_DIR) + - "/loader/conf/plugin.bash_completion.sh"); + std::filesystem::path scriptPath = IGN_PLUGIN_SOURCE_DIR; + scriptPath = scriptPath / "loader" / "conf" / "plugin.bash_completion.sh"; + std::ifstream scriptFile(scriptPath); + std::string script((std::istreambuf_iterator(scriptFile)), std::istreambuf_iterator()); From c6465c06fb5efa88f18861c6d7f73e786f862318 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 7 Jun 2022 03:09:57 -0400 Subject: [PATCH 13/16] do not hard code flags in test Signed-off-by: Mabel Zhang --- loader/conf/plugin.bash_completion.sh | 26 +++++++++++++++------- loader/src/ign_TEST.cc | 32 ++++++++++++++++----------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/loader/conf/plugin.bash_completion.sh b/loader/conf/plugin.bash_completion.sh index ce77e22f..337e1174 100644 --- a/loader/conf/plugin.bash_completion.sh +++ b/loader/conf/plugin.bash_completion.sh @@ -20,18 +20,21 @@ # This is a per-library function definition, used in conjunction with the # top-level entry point in ign-tools. +GZ_PLUGIN_COMPLETION_LIST=" + -h --help + --help-all + --version + -v --verbose + -i --info + -p --plugin +" + function _gz_plugin { if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]]; then # Specify options (-*) word list for this subcommand - COMPREPLY=($(compgen -W " - -h --help - --help-all - --version - -v --verbose - -i --info - -p --plugin - " -- "${COMP_WORDS[COMP_CWORD]}" )) + COMPREPLY=($(compgen -W "$GZ_PLUGIN_COMPLETION_LIST" \ + -- "${COMP_WORDS[COMP_CWORD]}" )) return else # Just use bash default auto-complete, because we never have two @@ -41,3 +44,10 @@ function _gz_plugin return fi } + +function _gz_plugin_flags +{ + for word in $GZ_PLUGIN_COMPLETION_LIST; do + echo "$word" + done +} diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index 2330e2d7..8ab3e1e9 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -194,22 +194,28 @@ TEST(ignTest, PluginHelpVsCompletionFlags) std::string ign = std::string(IGN_PATH); // Flags in help message - std::string output = custom_exec_str(ign + " plugin --help"); - EXPECT_NE(std::string::npos, output.find("--info")) << output; - EXPECT_NE(std::string::npos, output.find("--plugin")) << output; - EXPECT_NE(std::string::npos, output.find("--verbose")) << output; - EXPECT_NE(std::string::npos, output.find("--help")) << output; + std::string helpOutput = custom_exec_str(ign + " plugin --help"); - // Flags in bash completion + // Call the output function in the bash completion script std::filesystem::path scriptPath = IGN_PLUGIN_SOURCE_DIR; scriptPath = scriptPath / "loader" / "conf" / "plugin.bash_completion.sh"; - std::ifstream scriptFile(scriptPath); - std::string script((std::istreambuf_iterator(scriptFile)), - std::istreambuf_iterator()); + // Equivalent to: + // sh -c "bash -c \". /path/to/plugin.bash_completion.sh; _gz_plugin_flags\"" + std::string cmd = "bash -c \". " + scriptPath.string() + + "; _gz_plugin_flags\""; + std::string scriptOutput = custom_exec_str(cmd); - EXPECT_NE(std::string::npos, script.find("--info")) << script; - EXPECT_NE(std::string::npos, script.find("--plugin")) << script; - EXPECT_NE(std::string::npos, script.find("--verbose")) << script; - EXPECT_NE(std::string::npos, script.find("--help")) << script; + // Tokenize script output + std::istringstream iss(scriptOutput); + std::vector flags((std::istream_iterator(iss)), + std::istream_iterator()); + + EXPECT_GT(flags.size(), 0u); + + // Match each flag in script output with help message + for (std::string flag : flags) + { + EXPECT_NE(std::string::npos, helpOutput.find(flag)) << helpOutput; + } } From 9513232502ec040da449d7d742660d74746f01bb Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 7 Jun 2022 18:23:46 -0400 Subject: [PATCH 14/16] add stdc++fs for CI Signed-off-by: Mabel Zhang --- CMakeLists.txt | 6 ++++++ loader/CMakeLists.txt | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d23c8d3b..72c9f80e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,12 @@ ign_configure_project(VERSION_SUFFIX) # No project-specific options yet for ign-plugin +if (UNIX AND NOT APPLE) + set (EXTRA_TEST_LIB_DEPS stdc++fs) +else() + set (EXTRA_TEST_LIB_DEPS) +endif() + #============================================================================ # Search for project-specific dependencies #============================================================================ diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 4d53cd0b..6420b909 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -20,7 +20,9 @@ target_link_libraries(${loader} ign_build_tests( TYPE UNIT SOURCES ${tests} - LIB_DEPS ${loader} + LIB_DEPS + ${loader} + ${EXTRA_TEST_LIB_DEPS} TEST_LIST test_targets) foreach(test ${test_targets}) From 47c159a4fc8bf35e2f852bfc8119304b2157c134 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 7 Jun 2022 18:48:56 -0400 Subject: [PATCH 15/16] use 1.2.1 flags instead of 2.0.0~pre0 Signed-off-by: Mabel Zhang --- loader/conf/plugin.bash_completion.sh | 10 ++++++---- loader/src/ign_TEST.cc | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/loader/conf/plugin.bash_completion.sh b/loader/conf/plugin.bash_completion.sh index 337e1174..85723413 100644 --- a/loader/conf/plugin.bash_completion.sh +++ b/loader/conf/plugin.bash_completion.sh @@ -20,13 +20,15 @@ # This is a per-library function definition, used in conjunction with the # top-level entry point in ign-tools. +# TODO(anyone): Update for ign-plugin2, add --help-all and --version. Remove +# --versions and --force-version GZ_PLUGIN_COMPLETION_LIST=" - -h --help - --help-all - --version - -v --verbose -i --info -p --plugin + -v --verbose + -h --help + --force-version + --versions " function _gz_plugin diff --git a/loader/src/ign_TEST.cc b/loader/src/ign_TEST.cc index 8ab3e1e9..9a2adc38 100644 --- a/loader/src/ign_TEST.cc +++ b/loader/src/ign_TEST.cc @@ -194,7 +194,8 @@ TEST(ignTest, PluginHelpVsCompletionFlags) std::string ign = std::string(IGN_PATH); // Flags in help message - std::string helpOutput = custom_exec_str(ign + " plugin --help"); + std::string helpOutput = custom_exec_str(ign + " plugin --help " + + g_ignVersion); // Call the output function in the bash completion script std::filesystem::path scriptPath = IGN_PLUGIN_SOURCE_DIR; From d69a07aefd5bfd2834fa207ed3b1d1acfc9863e4 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 14 Jun 2022 15:28:09 -0700 Subject: [PATCH 16/16] Always install CLI files Signed-off-by: Louise Poubel --- CMakeLists.txt | 8 ++++---- loader/conf/CMakeLists.txt | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72c9f80e..6fad94f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,11 +43,11 @@ ign_find_package(DL #-------------------------------------- # Find ignition-tools +# Find if command is available. This is used to enable tests. +# Note that CLI files are installed regardless of whether the dependency is +# available during build time find_program(IGN_TOOLS_PROGRAM ign) -if (IGN_TOOLS_PROGRAM) - set(IGN_TOOLS_VER 1) -endif() - +set(IGN_TOOLS_VER 1) #============================================================================ # Configure the build diff --git a/loader/conf/CMakeLists.txt b/loader/conf/CMakeLists.txt index 39c5c1d6..f64809e7 100644 --- a/loader/conf/CMakeLists.txt +++ b/loader/conf/CMakeLists.txt @@ -30,10 +30,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MA configure_file( "plugin.bash_completion.sh" "${CMAKE_CURRENT_BINARY_DIR}/plugin${PROJECT_VERSION_MAJOR}.bash_completion.sh" @ONLY) -if (IGN_TOOLS_PROGRAM) - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/plugin${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}/plugin${PROJECT_VERSION_MAJOR}.bash_completion.sh + DESTINATION + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${IGN_TOOLS_VER}.completion.d)