summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2013-02-14 14:25:28 +0100
committerRadek Novacek <rnovacek@redhat.com>2013-02-14 14:45:57 +0100
commit1295eb25a2679aa41acc57b959d7126c707e1129 (patch)
tree21a03f4607bf7be4e70f4907e4a1520959c2a6d8
parent45dd9c06cba50124e011c87c969752ddf7017b88 (diff)
downloadopenlmi-providers-1295eb25a2679aa41acc57b959d7126c707e1129.tar.gz
openlmi-providers-1295eb25a2679aa41acc57b959d7126c707e1129.tar.xz
openlmi-providers-1295eb25a2679aa41acc57b959d7126c707e1129.zip
Improve OpenLMIMacros.cmake
* Make installation of .reg file optional * Find openlmi-mof-register instead of hardcoding it * Add unregister-provider target
-rw-r--r--cmake/modules/OpenLMIMacros.cmake19
1 files changed, 15 insertions, 4 deletions
diff --git a/cmake/modules/OpenLMIMacros.cmake b/cmake/modules/OpenLMIMacros.cmake
index ad20a00..ca63d0d 100644
--- a/cmake/modules/OpenLMIMacros.cmake
+++ b/cmake/modules/OpenLMIMacros.cmake
@@ -82,24 +82,35 @@ endmacro(konkretcmpi_generate MOF PROVIDERS HEADERS)
# @param[in] PROVIDER_NAME human-readable name of the provider
# @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
+# @param[in] DEST destination directory where to install .reg file (use "" to skip installation)
#
macro(cim_registration PROVIDER_NAME LIBRARY_NAME MOF DEST)
+ string(REPLACE ".mof" ".reg" REG ${MOF})
# Create registration out of shared library
add_custom_command(TARGET ${LIBRARY_NAME}
POST_BUILD
- COMMAND ${KONKRETCMPI_KONKRETREG} lib${LIBRARY_NAME}.so > LMI_${PROVIDER_NAME}.reg
+ COMMAND ${KONKRETCMPI_KONKRETREG} lib${LIBRARY_NAME}.so > ${REG}
COMMENT "Generating .reg file from library for ${PROVIDER_NAME}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# Install it
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LMI_${PROVIDER_NAME}.reg DESTINATION ${DEST})
+ if (NOT ${DEST} STREQUAL "")
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${REG} DESTINATION ${DEST})
+ endif (NOT ${DEST} STREQUAL "")
# Add custom target for registration
find_file(MOF_FILE
${MOF}
PATHS ${CMAKE_SOURCE_DIR}/mof/
)
+
+ find_file(OPENLMI_MOF_REGISTER
+ openlmi-mof-register
+ PATHS ${CMAKE_SOURCE_DIR}
+ /usr/bin
+ )
add_custom_target(register-${PROVIDER_NAME}
- ${CMAKE_SOURCE_DIR}/openlmi-mof-register register ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/LMI_${PROVIDER_NAME}.reg)
+ ${OPENLMI_MOF_REGISTER} register ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG})
+ add_custom_target(unregister-${PROVIDER_NAME}
+ ${OPENLMI_MOF_REGISTER} unregister ${MOF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${REG})
endmacro(cim_registration)