From 09432ee848ff28d470cfc43d54f84fca2073c1fc Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 15 May 2014 16:19:55 +0200 Subject: Include profile (un)registration in the (un)register-PROVIDER make targets This is an attempt to include profile (un)registration within the (un)register-PROVIDER make target. This commit extends the cim_registration macro by an extra argument of the profile file or list of profile files. To preserve API of the CMake modules this extra argument is an variable arg in fact and does not need to be specified. Pass a list variable to specify multiple profile files. --- cmake/modules/OpenLMIMacros.cmake | 11 +++++++++-- src/account/CMakeLists.txt | 2 +- src/fan/CMakeLists.txt | 2 +- src/hardware/CMakeLists.txt | 5 +++-- src/journald/CMakeLists.txt | 2 +- src/logicalfile/CMakeLists.txt | 4 ++-- src/power/CMakeLists.txt | 2 +- src/realmd/CMakeLists.txt | 5 +++-- src/service-dbus/CMakeLists.txt | 5 +++-- src/service/CMakeLists.txt | 5 +++-- src/software-dbus/CMakeLists.txt | 5 +++-- tools/devassistant/files/crt/c/openlmi/src/CMakeLists.txt.tpl | 2 +- 12 files changed, 31 insertions(+), 19 deletions(-) diff --git a/cmake/modules/OpenLMIMacros.cmake b/cmake/modules/OpenLMIMacros.cmake index d55f983..055a8cc 100644 --- a/cmake/modules/OpenLMIMacros.cmake +++ b/cmake/modules/OpenLMIMacros.cmake @@ -123,6 +123,7 @@ endmacro(konkretcmpi_generate MOF PROVIDERS HEADERS) # @param[in] LIBRARY_NAME name of the library without lib prefix and .so suffix (same as for add_library) # @param[in] MOF name of the MOF file # @param[in] DEST destination directory where to install .reg file (use "" to skip installation) +# @param[in] ARGN optional varargs argument: path(s) to the profile(s) to be registered # macro(cim_registration PROVIDER_NAME LIBRARY_NAME MOF DEST) string(REPLACE ".mof" ".reg" REG ${MOF}) @@ -143,11 +144,17 @@ macro(cim_registration PROVIDER_NAME LIBRARY_NAME MOF DEST) ${MOF} PATHS ${CMAKE_SOURCE_DIR}/mof/ ) + set(PROFILE_DO_REG "false") + if (NOT "${ARGN}" STREQUAL "") + set(PROFILE_DO_REG "true") + endif (NOT "${ARGN}" STREQUAL "") add_custom_target(register-${PROVIDER_NAME} - ${OPENLMI_MOF_REGISTER} -v ${OPENLMI_VERSION} register ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG}) + ${OPENLMI_MOF_REGISTER} -v ${OPENLMI_VERSION} register ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG} && + if ${PROFILE_DO_REG}\; then ${OPENLMI_MOF_REGISTER} --just-mofs -n root/interop -c tog-pegasus register ${ARGN}\; fi) add_custom_target(unregister-${PROVIDER_NAME} - ${OPENLMI_MOF_REGISTER} -v ${OPENLMI_VERSION} unregister ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG}) + ${OPENLMI_MOF_REGISTER} -v ${OPENLMI_VERSION} unregister ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG} && + if ${PROFILE_DO_REG}\; then ${OPENLMI_MOF_REGISTER} --just-mofs -n root/interop -c tog-pegasus unregister ${ARGN}\; fi) endmacro(cim_registration) diff --git a/src/account/CMakeLists.txt b/src/account/CMakeLists.txt index 6390ae2..9d416c9 100644 --- a/src/account/CMakeLists.txt +++ b/src/account/CMakeLists.txt @@ -49,7 +49,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${GLIB_INCLU target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES} ${LIBUSER_LIBRARIES} openlmiindmanager) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(PROGRAMS ${ACCOUNT_SCRIPT} DESTINATION libexec/pegasus) diff --git a/src/fan/CMakeLists.txt b/src/fan/CMakeLists.txt index 446e38b..7918a57 100644 --- a/src/fan/CMakeLists.txt +++ b/src/fan/CMakeLists.txt @@ -28,9 +28,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR}) target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} sensors) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_Fan_Profile.mof") profile_mof_generate("90_LMI_Fan_Profile.mof.skel" "${TARGET_MOF}" "${CIM_CLASSES}") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/src/hardware/CMakeLists.txt b/src/hardware/CMakeLists.txt index 29b63d3..92a9ea6 100644 --- a/src/hardware/CMakeLists.txt +++ b/src/hardware/CMakeLists.txt @@ -34,13 +34,14 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${LIBPCI_INC target_link_libraries(${LIBRARY_NAME} m openlmicommon ${KONKRETCMPI_LIBRARIES} ${LIBPCI_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_${PROVIDER_NAME}_Profile.mof") profile_mof_generate("90_LMI_${PROVIDER_NAME}_Profile.mof.skel" "${TARGET_MOF}" "${CIM_CLASSES}") set(TARGET_MOF_DMTF "${CMAKE_BINARY_DIR}/mof/90_LMI_${PROVIDER_NAME}_Profile_DMTF.mof") configure_file("90_LMI_${PROVIDER_NAME}_Profile_DMTF.mof" "${TARGET_MOF_DMTF}" COPYONLY) +set(TARGET_MOFS "${TARGET_MOF}" "${TARGET_MOF_DMTF}") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOFS}") + install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/src/journald/CMakeLists.txt b/src/journald/CMakeLists.txt index 7e956c0..63a5246 100644 --- a/src/journald/CMakeLists.txt +++ b/src/journald/CMakeLists.txt @@ -52,7 +52,7 @@ set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_Journald_Profile.mof") profile_mof_generate("90_LMI_Journald_Profile.mof.skel" "${TARGET_MOF}" "${CIM_PROVIDERS_CLASSES}") # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) diff --git a/src/logicalfile/CMakeLists.txt b/src/logicalfile/CMakeLists.txt index 14b33c5..9de6046 100644 --- a/src/logicalfile/CMakeLists.txt +++ b/src/logicalfile/CMakeLists.txt @@ -34,11 +34,11 @@ target_link_libraries(${LIBRARY_NAME} openlmicommon ${LIBSELINUX_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_LogicalFile_Profile.mof") profile_mof_generate("90_LMI_LogicalFile_Profile.mof.skel" "${TARGET_MOF}" "${CIM_CLASSES}") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") + install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/src/power/CMakeLists.txt b/src/power/CMakeLists.txt index 44b2109..05d5bbf 100644 --- a/src/power/CMakeLists.txt +++ b/src/power/CMakeLists.txt @@ -46,7 +46,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${GLIB_INCLU target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(PROGRAMS ${POWERMANAGEMENT_SCRIPT} DESTINATION libexec/pegasus) diff --git a/src/realmd/CMakeLists.txt b/src/realmd/CMakeLists.txt index dbf2e54..961c7b1 100644 --- a/src/realmd/CMakeLists.txt +++ b/src/realmd/CMakeLists.txt @@ -43,11 +43,12 @@ target_link_libraries(${LIBRARY_NAME} ) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_Realmd_Profile.mof") profile_mof_generate("90_LMI_Realmd_Profile.mof.skel" "${TARGET_MOF}" "${CIM_CLASSES}") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") + + install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/src/service-dbus/CMakeLists.txt b/src/service-dbus/CMakeLists.txt index 60a3d8a..02500f9 100644 --- a/src/service-dbus/CMakeLists.txt +++ b/src/service-dbus/CMakeLists.txt @@ -34,11 +34,12 @@ target_link_libraries(${LIBRARY_NAME} ${GIO_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_Service_Profile.mof") profile_mof_generate("90_LMI_Service_Profile.mof.skel" "${TARGET_MOF}" "LMI_Service") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") + + install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt index 92e94dc..99f2cac 100644 --- a/src/service/CMakeLists.txt +++ b/src/service/CMakeLists.txt @@ -24,11 +24,12 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR}) target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} "60_LMI_Service.mof" share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_Service_Profile.mof") profile_mof_generate("90_LMI_Service_Profile.mof.skel" "${TARGET_MOF}" "LMI_Service") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} "60_LMI_Service.mof" share/openlmi-providers "${TARGET_MOF}") + + install(PROGRAMS util/servicedisc.sh util/serviceutil.sh DESTINATION libexec) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) diff --git a/src/software-dbus/CMakeLists.txt b/src/software-dbus/CMakeLists.txt index 5202c33..04d8508 100644 --- a/src/software-dbus/CMakeLists.txt +++ b/src/software-dbus/CMakeLists.txt @@ -32,11 +32,12 @@ target_link_libraries(${LIBRARY_NAME} ${PACKAGEKIT_LIBRARIES}) # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) - set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_${PROVIDER_NAME}_Profile.mof") profile_mof_generate("90_LMI_${PROVIDER_NAME}_Profile.mof.skel" "${TARGET_MOF}" "${CIM_CLASSES}") +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") + + install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) install(FILES ${TARGET_MOF} DESTINATION share/openlmi-providers/) diff --git a/tools/devassistant/files/crt/c/openlmi/src/CMakeLists.txt.tpl b/tools/devassistant/files/crt/c/openlmi/src/CMakeLists.txt.tpl index 237f20e..37aac2f 100644 --- a/tools/devassistant/files/crt/c/openlmi/src/CMakeLists.txt.tpl +++ b/tools/devassistant/files/crt/c/openlmi/src/CMakeLists.txt.tpl @@ -41,7 +41,7 @@ set(TARGET_MOF "${CMAKE_BINARY_DIR}/mof/90_LMI_{{ PROJECT_NAME }}_Profile.mof") profile_mof_generate("90_LMI_{{ PROJECT_NAME }}_Profile.mof.skel" "${TARGET_MOF}" "${CIM_PROVIDERS_CLASSES}") # Create registration file -cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers "${TARGET_MOF}") install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi/) install(PROGRAMS ${CIMPROVAGT_SCRIPT} DESTINATION libexec/pegasus) -- cgit