diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad4930b..db212a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@ option(FORCE_BUILD_VENDOR_PKG
"Build TinyXML from source, even if system-installed package is available"
OFF)
+find_package(ament_cmake REQUIRED)
+
if(NOT FORCE_BUILD_VENDOR_PKG)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
find_package(TinyXML)
@@ -37,16 +39,8 @@ else()
message(STATUS "Found TinyXML. Using TinyXML from system.")
endif()
-configure_file(tinyxml_vendorConfig.cmake.in "${PROJECT_BINARY_DIR}/tinyxml_vendorConfig.cmake" @ONLY)
-configure_file(tinyxml_vendorConfig-version.cmake.in "${PROJECT_BINARY_DIR}/tinyxml_vendorConfig-version.cmake" @ONLY)
-
install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME})
-install(FILES
- package.xml
- DESTINATION share/${PROJECT_NAME})
-
-install(FILES
- "${PROJECT_BINARY_DIR}/tinyxml_vendorConfig.cmake"
- "${PROJECT_BINARY_DIR}/tinyxml_vendorConfig-version.cmake"
- DESTINATION share/${PROJECT_NAME}/cmake)
+ament_package(
+ CONFIG_EXTRAS "tinyxml_vendor-extras.cmake"
+)
diff --git a/package.xml b/package.xml
index 8b37b0e..25937d2 100644
--- a/package.xml
+++ b/package.xml
@@ -7,11 +7,11 @@
Steven! Ragnarök
Apache License 2.0
- cmake
+ ament_cmake
tinyxml
- cmake
+ ament_cmake
diff --git a/tinyxml_vendor-extras.cmake b/tinyxml_vendor-extras.cmake
new file mode 100644
index 0000000..2c56101
--- /dev/null
+++ b/tinyxml_vendor-extras.cmake
@@ -0,0 +1,15 @@
+# Copyright 2019 Open Source Robotics Foundation, Inc.
+#
+# 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.
+
+list(INSERT CMAKE_MODULE_PATH 0 "${tinyxml_vendor_DIR}/Modules")
diff --git a/tinyxml_vendorConfig-version.cmake.in b/tinyxml_vendorConfig-version.cmake.in
deleted file mode 100644
index 53f0fef..0000000
--- a/tinyxml_vendorConfig-version.cmake.in
+++ /dev/null
@@ -1,13 +0,0 @@
-set(PACKAGE_VERSION @PACKAGE_VERSION@)
-
-set(PACKAGE_VERSION_EXACT False)
-set(PACKAGE_VERSION_COMPATIBLE False)
-
-if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT True)
- set(PACKAGE_VERSION_COMPATIBLE True)
-endif()
-
-if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_COMPATIBLE True)
-endif()
diff --git a/tinyxml_vendorConfig.cmake.in b/tinyxml_vendorConfig.cmake.in
deleted file mode 100644
index ad1eede..0000000
--- a/tinyxml_vendorConfig.cmake.in
+++ /dev/null
@@ -1,13 +0,0 @@
-# prevent multiple inclusion
-if(_@PROJECT_NAME@_CONFIG_INCLUDED)
- return()
-endif()
-set(_@PROJECT_NAME@_CONFIG_INCLUDED TRUE)
-
-# output package information
-if(NOT @PROJECT_NAME@_FIND_QUIETLY)
- message(STATUS "Found @PROJECT_NAME@: @PACKAGE_VERSION@ (${@PROJECT_NAME@_DIR})")
-endif()
-
-# add the local Modules directory to the modules path, so FindPoco.cmake is considered.
-list(INSERT CMAKE_MODULE_PATH 0 "${@PROJECT_NAME@_DIR}/Modules")