Skip to content

Commit

Permalink
Adding CONFIG option (#211)
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Mahesheka <[email protected]>

Co-authored-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
harshmahesheka and j-rivero authored Apr 8, 2022
1 parent c51ef5d commit 3fb1714
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#################################################
# ign_find_package(<PACKAGE_NAME>
# [REQUIRED] [PRIVATE] [EXACT] [QUIET] [BUILD_ONLY] [PKGCONFIG_IGNORE]
# [REQUIRED] [PRIVATE] [EXACT] [QUIET] [CONFIG] [BUILD_ONLY] [PKGCONFIG_IGNORE]
# [COMPONENTS <components_of_PACKAGE_NAME>]
# [OPTIONAL_COMPONENTS <components_of_PACKAGE_NAME>]
# [REQUIRED_BY <components_of_project>]
Expand Down Expand Up @@ -50,6 +50,10 @@
# output, except there will be no warning if the package is missing,
# unless REQUIRED or REQUIRED_BY is specified.
#
# [CONFIG]: Optional. If provided, it will be passed forward to cmake's
# find_package(~) command. This will trigger Config mode search rather than
# Module mode.
#
# [BUILD_ONLY]: Optional. Use this to indicate that the project only needs this
# package while building, and it does not need to be available to
# the consumer of this project at all. Normally this should only
Expand Down Expand Up @@ -138,7 +142,7 @@ macro(ign_find_package PACKAGE_NAME)

#------------------------------------
# Define the expected arguments
set(options REQUIRED PRIVATE EXACT QUIET BUILD_ONLY PKGCONFIG_IGNORE)
set(options REQUIRED PRIVATE EXACT QUIET CONFIG BUILD_ONLY PKGCONFIG_IGNORE)
set(oneValueArgs VERSION PRETTY PURPOSE EXTRA_ARGS PKGCONFIG PKGCONFIG_LIB PKGCONFIG_VER_COMPARISON)
set(multiValueArgs REQUIRED_BY PRIVATE_FOR COMPONENTS OPTIONAL_COMPONENTS)

Expand All @@ -162,6 +166,10 @@ macro(ign_find_package PACKAGE_NAME)
list(APPEND ${PACKAGE_NAME}_find_package_args EXACT)
endif()

if(ign_find_package_CONFIG)
list(APPEND ${PACKAGE_NAME}_find_package_args CONFIG)
endif()

if(ign_find_package_COMPONENTS)
list(APPEND ${PACKAGE_NAME}_find_package_args COMPONENTS ${ign_find_package_COMPONENTS})
endif()
Expand Down Expand Up @@ -275,6 +283,11 @@ macro(ign_find_package PACKAGE_NAME)
ign_string_append(${PACKAGE_NAME}_dependency_args EXACT)
endif()

# If we have specified to use CONFIG mode, we should provide that as well.
if(ign_find_package_CONFIG)
ign_string_append(${PACKAGE_NAME}_dependency_args CONFIG)
endif()

# NOTE (MXG): 7 seems to be the number of escapes required to get
# "${ign_package_required}" and "${ign_package_quiet}" to show up correctly
# as strings in the final config-file outputs. It is unclear to me why the
Expand Down

0 comments on commit 3fb1714

Please sign in to comment.