diff --git a/sqlite3_vendor/CMakeLists.txt b/sqlite3_vendor/CMakeLists.txt
index e3e30d656..4c2b59503 100644
--- a/sqlite3_vendor/CMakeLists.txt
+++ b/sqlite3_vendor/CMakeLists.txt
@@ -1,8 +1,16 @@
cmake_minimum_required(VERSION 3.5)
project(sqlite3_vendor)
-list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
-find_package(SQLite3)
+find_package(ament_cmake REQUIRED)
+
+option(FORCE_BUILD_VENDOR_PKG
+ "Build SQLite3 from source, even if system-installed package is available"
+ OFF)
+
+if(NOT FORCE_BUILD_VENDOR_PKG)
+ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
+ find_package(SQLite3 QUIET)
+endif()
if (NOT SQLite3_FOUND)
set(extra_cmake_args)
@@ -30,16 +38,8 @@ else ()
message(STATUS "Found SQLite3. Using SQLite3 from system.")
endif ()
-configure_file(sqlite3_vendorConfig.cmake.in "${PROJECT_BINARY_DIR}/sqlite3_vendorConfig.cmake" @ONLY)
-configure_file(sqlite3_vendorConfig-version.cmake.in "${PROJECT_BINARY_DIR}/sqlite3_vendorConfig-version.cmake" @ONLY)
-
install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME})
-install(FILES
- package.xml
- DESTINATION share/${PROJECT_NAME})
-
-install(FILES
- "${PROJECT_BINARY_DIR}/sqlite3_vendorConfig.cmake"
- "${PROJECT_BINARY_DIR}/sqlite3_vendorConfig-version.cmake"
- DESTINATION share/${PROJECT_NAME}/cmake)
+ament_package(
+ CONFIG_EXTRAS "sqlite3_vendor-extras.cmake"
+)
diff --git a/sqlite3_vendor/package.xml b/sqlite3_vendor/package.xml
index bd93ac121..70cdd96d6 100644
--- a/sqlite3_vendor/package.xml
+++ b/sqlite3_vendor/package.xml
@@ -8,11 +8,11 @@
ROS Tooling Working Group
Apache License 2.0
- cmake
+ ament_cmake
libsqlite3-dev
- cmake
+ ament_cmake
diff --git a/sqlite3_vendor/sqlite3_vendor-extras.cmake b/sqlite3_vendor/sqlite3_vendor-extras.cmake
new file mode 100644
index 000000000..eee462b06
--- /dev/null
+++ b/sqlite3_vendor/sqlite3_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 "${sqlite3_vendor_DIR}/Modules")
diff --git a/sqlite3_vendor/sqlite3_vendorConfig-version.cmake.in b/sqlite3_vendor/sqlite3_vendorConfig-version.cmake.in
deleted file mode 100644
index 53f0fef8c..000000000
--- a/sqlite3_vendor/sqlite3_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/sqlite3_vendor/sqlite3_vendorConfig.cmake.in b/sqlite3_vendor/sqlite3_vendorConfig.cmake.in
deleted file mode 100644
index 31350c392..000000000
--- a/sqlite3_vendor/sqlite3_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 FindSQLite3.cmake is considered.
-list(INSERT CMAKE_MODULE_PATH 0 "${@PROJECT_NAME@_DIR}/Modules")