diff options
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/CuraMacros.cmake | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/cmake/modules/CuraMacros.cmake b/cmake/modules/CuraMacros.cmake index 6c80c7f..ffd9d32 100644 --- a/cmake/modules/CuraMacros.cmake +++ b/cmake/modules/CuraMacros.cmake @@ -76,16 +76,26 @@ endmacro(konkretcmpi_generate MOF PROVIDERS HEADERS) # This macro creates registration file from shared library # -# @param[in] PROVIDER name of the library without lib and .so (same as for add_library) +# @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 # -macro(cim_registration PROVIDER) +macro(cim_registration PROVIDER_NAME LIBRARY_NAME MOF) # Create registration out of shared library - add_custom_command(TARGET ${PROVIDER} + add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD - COMMAND ${KONKRETCMPI_KONKRETREG} -r lib${PROVIDER}.so > ${PROVIDER}.registration - COMMENT "Generating .reg file from library for ${PROVIDER}" + COMMAND ${KONKRETCMPI_KONKRETREG} -r lib${LIBRARY_NAME}.so > ${PROVIDER_NAME}.registration + COMMENT "Generating .reg file from library for ${PROVIDER_NAME}" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) # Install it - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROVIDER}.registration DESTINATION share/cura-providers/) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROVIDER_NAME}.registration DESTINATION share/cura-providers/) + + # Add custom target for registration + find_file(MOF_FILE + ${MOF} + PATHS ${CMAKE_SOURCE_DIR}/mof/ + ) + add_custom_target(register-${PROVIDER_NAME} + ${CMAKE_SOURCE_DIR}/provider-register.sh -m ${MOF_FILE} -r ${CMAKE_CURRENT_BINARY_DIR}/${PROVIDER_NAME}.registration) endmacro(cim_registration) |