diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index bbaa351c..404af74c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -26,6 +26,7 @@ if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") use_component_deps_b use_component_deps_c export_component_deps_cmake + export_component_deps_pkgconfig ) endif() @@ -56,6 +57,8 @@ foreach(example ${example_directories}) set(example_tarball_name gz-component_deps-0.1.0.tar.bz2) elseif (${example} STREQUAL "export_component_deps_cmake") set(example_tarball_name gz-export_component_deps_cmake-0.1.0.tar.bz2) + elseif (${example} STREQUAL "export_component_deps_pkgconfig") + set(example_tarball_name gz-export_component_deps_pkgconfig-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_component_deps_a") set(example_tarball_name gz-use_component_deps_a-0.1.0.tar.bz2) elseif (${example} STREQUAL "use_component_deps_b") @@ -181,6 +184,9 @@ foreach (build_type ${build_types}) if (TARGET export_component_deps_cmake_${build_type}) add_dependencies(export_component_deps_cmake_${build_type} use_component_deps_c_${build_type}) endif() + if (TARGET export_component_deps_pkgconfig_${build_type}) + add_dependencies(export_component_deps_pkgconfig_${build_type} use_component_deps_c_${build_type}) + endif() endforeach() # test that core_child pkg-config file requires core_nodep diff --git a/examples/export_component_deps_pkgconfig/CMakeLists.txt b/examples/export_component_deps_pkgconfig/CMakeLists.txt new file mode 100644 index 00000000..caa83d74 --- /dev/null +++ b/examples/export_component_deps_pkgconfig/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) +project(gz-export_component_deps_pkgconfig VERSION 0.1.0) +find_package(gz-cmake4 REQUIRED) +gz_configure_project() +include(GzPkgConfig) +gz_pkg_check_modules(gz-use_component_deps_c "gz-use_component_deps_c") +gz_configure_build(QUIT_IF_BUILD_ERRORS) +gz_create_packages() +gz_create_docs() diff --git a/examples/export_component_deps_pkgconfig/src/AlmostEmpty.cc b/examples/export_component_deps_pkgconfig/src/AlmostEmpty.cc new file mode 100644 index 00000000..46e7664b --- /dev/null +++ b/examples/export_component_deps_pkgconfig/src/AlmostEmpty.cc @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2018 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. + * +*/ + +#include diff --git a/examples/export_component_deps_pkgconfig/src/CMakeLists.txt b/examples/export_component_deps_pkgconfig/src/CMakeLists.txt new file mode 100644 index 00000000..30e02308 --- /dev/null +++ b/examples/export_component_deps_pkgconfig/src/CMakeLists.txt @@ -0,0 +1,6 @@ +gz_get_libsources_and_unittests(sources gtest_sources) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} + PUBLIC + gz-use_component_deps_c::gz-use_component_deps_c) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})