Skip to content

Commit

Permalink
Make specifying the CMake components optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Jun 3, 2023
1 parent 4d29ae1 commit 977fb9d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmake/pcre2-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
# -----------------
# To make use of the static library instead of the shared one, one needs
# to set the variable PCRE2_USE_STATIC_LIBS to ON before calling find_package.
#
# The following components are supported: 8BIT, 16BIT, 32BIT and POSIX.
# They used to be required but not anymore; all available targets will
# be defined regardless of the requested components.
# Example:
# set(PCRE2_USE_STATIC_LIBS ON)
# find_package(PCRE2 CONFIG COMPONENTS 8BIT)
# find_package(PCRE2 CONFIG)
#
# This will define the following variables:
#
Expand Down Expand Up @@ -51,13 +55,6 @@ _pcre2_add_component_target(16BIT 16)
_pcre2_add_component_target(32BIT 32)
_pcre2_add_component_target(POSIX posix)

# Check if at least one component has been specified.
list(LENGTH PCRE2_FIND_COMPONENTS PCRE2_NCOMPONENTS)
if (PCRE2_NCOMPONENTS LESS 1)
message(FATAL_ERROR "No components have been specified. This is not allowed. Please, specify at least one component.")
endif ()
unset(PCRE2_NCOMPONENTS)

# When POSIX component has been specified make sure that also 8BIT component is specified.
set(PCRE2_8BIT_COMPONENT FALSE)
set(PCRE2_POSIX_COMPONENT FALSE)
Expand Down

0 comments on commit 977fb9d

Please sign in to comment.