Skip to content

Commit c373a94

Browse files
committed
cmake: Fix package configuration file
When loading a package configuration file, `find_package` defines variables to provide information about the call arguments. In particular, `CMAKE_FIND_PACKAGE_NAME` represents the package name. This change uses this variable instead of a hardcoded name.
1 parent 8b8a476 commit c373a94

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cmake/Config.cmake.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
set(_Libmultiprocess_supported_components Bin Lib)
88

99
# If no components specified, include all components.
10-
list(LENGTH Libmultiprocess_FIND_COMPONENTS Libmultiprocess_FIND_COMPONENTS_len)
11-
if(Libmultiprocess_FIND_COMPONENTS_len EQUAL 0)
12-
set(Libmultiprocess_FIND_COMPONENTS ${_Libmultiprocess_supported_components})
10+
list(LENGTH ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS_len)
11+
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS_len EQUAL 0)
12+
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS ${_Libmultiprocess_supported_components})
1313
endif()
1414

15-
if ("Bin" IN_LIST Libmultiprocess_FIND_COMPONENTS)
15+
if ("Bin" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
1616
include("${CMAKE_CURRENT_LIST_DIR}/TargetCapnpSources.cmake")
1717
endif()
1818

19-
if ("Lib" IN_LIST Libmultiprocess_FIND_COMPONENTS)
19+
if ("Lib" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
2020
include(CMakeFindDependencyMacro)
2121
find_dependency(CapnProto)
2222
endif()
2323

24-
foreach(_comp ${Libmultiprocess_FIND_COMPONENTS})
24+
foreach(_comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
2525
if (NOT _comp IN_LIST _Libmultiprocess_supported_components)
26-
set(Libmultiprocess_FOUND False)
27-
set(Libmultiprocess_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
26+
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
27+
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
2828
endif()
2929
include("${CMAKE_CURRENT_LIST_DIR}/${_comp}Targets.cmake")
3030
endforeach()

0 commit comments

Comments
 (0)