OrangesFindPackageHelpers¶
Helper functions for internal use inside find modules.
For convenience, this module also includes the FeatureSummary
, FindPackageMessage
, and
FindPackageHandleStandardArgs
modules.
Resolve a find_package() component list¶
- find_package_default_component_list¶
find_package_default_component_list (<validComponents...>)
Pass the list of valid component names to this macro, and it detects if the user requested any invalid
components in their find_package()
call, and raises a warning (if the QUIET
flag wasn’t passed
to find_package()
).
Additionally, if All
, ALL
, or all
was passed as a component name by the user to
find_package()
, then this macro sets the variable ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS
to the full list of valid component names passed to this macro. If the All
component was specified
as a required component in the user’s find_package()
call, then this macro sets the variables
${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_<comp>
to ON
for each of the valid component names.
For example, if you have a module FindFoo.cmake
that uses this macro like so:
find_package_default_component_list (Comp1 Comp2)
Then if a user calls:
find_package (Foo COMPONENTS ALL)
Then inside the FindFoo.cmake
module:
# After this call...
find_package_default_component_list (Comp1 Comp2)
# This will print out "Components: Comp1;Comp2"
message (STATUS "Components: ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
Similarly, if the user calls:
find_package (Foo COMPONENTS blargh)
Then the call to find_package_default_component_list
in the FindFoo.cmake
module will print a
warning that blargh
is not a valid component name.
Set the MacOS architectures of a prebuilt library¶
- find_package_detect_macos_arch¶
find_package_detect_macos_arch (<target> <libPath>)
This function runs lipo -archs <libPath>
and uses the output to set the OSX_ARCHITECTURES
property on the given <target>
.
The cache variable PROGRAM_LIPO
holds the path to the lipo executable.
This function does nothing on non-Apple platforms.
For example, if you have the absolute path of a library (such as the output of find_library()
), then
you can use this macro like so:
Cache variables¶
- PROGRAM_LIPO¶
This cache variable holds the path to the lipo executable, used by the find_package_detect_macos_arch()
function.