diff options
-rw-r--r-- | examples/activeqt/qutlook/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/activeqt/container/Qt6AxContainerMacros.cmake | 34 |
2 files changed, 32 insertions, 16 deletions
diff --git a/examples/activeqt/qutlook/CMakeLists.txt b/examples/activeqt/qutlook/CMakeLists.txt index af1de27..5e009fa 100644 --- a/examples/activeqt/qutlook/CMakeLists.txt +++ b/examples/activeqt/qutlook/CMakeLists.txt @@ -20,11 +20,18 @@ find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) find_package(Qt6 COMPONENTS AxContainer) +qt_add_executable(qutlook + addressview.cpp addressview.h + main.cpp ) + set_target_properties(qutlook PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) + +qt6_target_typelibs(qutlook "msoutl:{00062FFF-0000-0000-C000-000000000046}") + target_link_libraries(qutlook PUBLIC Qt::AxContainer Qt::Core @@ -32,13 +39,6 @@ target_link_libraries(qutlook PUBLIC Qt::Widgets ) -if(NOT TYPELIBS_ISEMPTY) - target_sources(qutlook PUBLIC - addressview.cpp addressview.h - main.cpp - ) -endif() - install(TARGETS qutlook RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/src/activeqt/container/Qt6AxContainerMacros.cmake b/src/activeqt/container/Qt6AxContainerMacros.cmake index 4e90943..82a0745 100644 --- a/src/activeqt/container/Qt6AxContainerMacros.cmake +++ b/src/activeqt/container/Qt6AxContainerMacros.cmake @@ -8,6 +8,10 @@ # CMake find_file function rules. See https://cmake.org/cmake/help/latest/command/find_file.html # for details. # Note: The library name must include a file suffix, e.g "ieframe.dll". +# LIBRARIES also may contain the library UUID in the following format: +# <generated_files_basename>:<{00000000-0000-0000-0000-000000000000}> +# The 'generated_files_basename' may contain ASCII letters, numbers and underscores and will be +# used as the base name for the generated files. # # OUTPUT_DIRECTORY: Custom location of the generated source files. # ${CMAKE_CURRENT_BINARY_DIR} is the default location if not specified. (OPTIONAL) @@ -34,22 +38,34 @@ function(qt6_target_typelibs target) endif() set(out_sources "") + set(hex "[a-fA-F0-9]") + set(ident_ "[a-fA-F0-9_]") foreach(lib IN LISTS arg_LIBRARIES) unset(libpath CACHE) - # If lib exists on the filesystem, we assume the user provided the path. - get_filename_component(lib_abspath "${lib}" ABSOLUTE) - if(EXISTS "${lib_abspath}") - set(libpath "${lib_abspath}") + if(lib MATCHES "^(${ident_}+):(\\{${hex}{8}-${hex}{4}-${hex}{4}-${hex}{4}-${hex}{12}\\})$") + set(libpath "${CMAKE_MATCH_2}") + set(out_basename "${CMAKE_MATCH_1}") + string(MAKE_C_IDENTIFIER "${out_basename}" out_basename_valid) + if(NOT "${out_basename_valid}" STREQUAL "${out_basename}") + message("The specified generated files basename ${out_basename} is not valid\ +C indentifier") + endif() else() - find_file(libpath NAMES "${lib}") - if(NOT libpath) - message(FATAL_ERROR "qt6_target_typelibs: Unable to find type lib with name ${lib}") + # If lib exists on the filesystem, we assume the user provided the path. + get_filename_component(lib_abspath "${lib}" ABSOLUTE) + if(EXISTS "${lib_abspath}") + set(libpath "${lib_abspath}") + else() + find_file(libpath NAMES "${lib}") + if(NOT libpath) + message(FATAL_ERROR "qt6_target_typelibs: Unable to find type lib with name ${lib}") + endif() endif() + + get_filename_component(out_basename "${libpath}" NAME_WE) endif() - get_filename_component(out_basename "${libpath}" NAME_WE) set(out_filebasepath "${output_directory}/${out_basename}") - set(out_header "${out_filebasepath}.h") set_source_files_properties("${out_header}" PROPERTIES HEADER_FILE_ONLY TRUE) set(out_source "${out_filebasepath}.cpp") |