Skip to content

Commit

Permalink
Support component-based find_package (#756)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Feb 12, 2024
1 parent 765376a commit 734a5cf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
@PACKAGE_INIT@

# Support both casing styles
list(APPEND JSONBINPACK_COMPONENTS ${JSONBinPack_FIND_COMPONENTS})
list(APPEND JSONBINPACK_COMPONENTS ${jsonbinpack_FIND_COMPONENTS})
if(NOT JSONBINPACK_COMPONENTS)
list(APPEND JSONBINPACK_COMPONENTS runtime)
list(APPEND JSONBINPACK_COMPONENTS compiler)
endif()

include(CMakeFindDependencyMacro)
find_dependency(JSONToolkit COMPONENTS uri json jsonpointer jsonschema)

include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_jsonbinpack_runtime.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_jsonbinpack_compiler.cmake")

foreach(component ${JSONBINPACK_COMPONENTS})
if(component STREQUAL "runtime")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_jsonbinpack_runtime.cmake")
elseif(component STREQUAL "compiler")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_jsonbinpack_compiler.cmake")
else()
message(FATAL_ERROR "Unknown JSON BinPack component: ${component}")
endif()
endforeach()

check_required_components("@PROJECT_NAME@")

0 comments on commit 734a5cf

Please sign in to comment.