Skip to content

Commit

Permalink
cmake: properly handle dependencies in package config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tectu committed Jun 30, 2022
1 parent 4fbe22d commit 94d059b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ if (MALLOY_FEATURE_APPFW)
set(MALLOY_DEPENDENCY_INJA ON)
endif()

# Dependency minimum versions
set(MALLOY_DEPENDENCY_BOOST_VERSION_MIN 1.74.0)

# Add the main library
add_subdirectory(lib)

Expand Down
3 changes: 2 additions & 1 deletion lib/malloy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ write_basic_package_version_file(
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(malloy-config.cmake.in malloy-config.cmake @ONLY)
install(
FILES
malloy-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/malloy-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/malloy-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/malloy
)
Expand Down
2 changes: 1 addition & 1 deletion lib/malloy/core/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MALLOY_BINARY_DIR})
########################################################################################################################
find_package(
Boost
1.74.0
${MALLOY_DEPENDENCY_BOOST_VERSION_MIN}
REQUIRED
)

Expand Down
3 changes: 0 additions & 3 deletions lib/malloy/malloy-config.cmake

This file was deleted.

15 changes: 15 additions & 0 deletions lib/malloy/malloy-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include(CMakeFindDependencyMacro)

# Capture dependency configurations
set(MALLOY_DEPENDENCY_OPENSSL @MALLOY_DEPENDENCY_OPENSSL@)

# Include dependencies
find_dependency(Boost @MALLOY_DEPENDENCY_BOOST_VERSION_MIN@ REQUIRED)
find_dependency(fmt REQUIRED)
find_dependency(spdlog REQUIRED)
if (MALLOY_DEPENDENCY_OPENSSL)
find_dependency(OpenSSL REQUIRED)
endif()

# Add the targets file
include("${CMAKE_CURRENT_LIST_DIR}/malloy-targets.cmake")

0 comments on commit 94d059b

Please sign in to comment.