Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CONFIG option #211

Merged
merged 4 commits into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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