[cmake-developers] CMAKE_AUTOMOC, system include dirs and target include directories

Stephen Kelly steveire at gmail.com
Sun Mar 17 08:41:49 EDT 2013


Stephen Kelly wrote:

> find_package(Qt5Test)
> 

Something like this is also needed to reproduce without patching Qt:


  # Temporary until upstream does this:
  foreach(_component Core Test)
    if (TARGET Qt5::${_component})
      set_property(TARGET Qt5::${_component}
        APPEND PROPERTY
          INTERFACE_INCLUDE_DIRECTORIES ${Qt5${_component}_INCLUDE_DIRS})
      set_property(TARGET Qt5::${_component}
        APPEND PROPERTY
          INTERFACE_COMPILE_DEFINITIONS 
${Qt5${_component}_COMPILE_DEFINITIONS})
    endif()
  endforeach()

  set_property(TARGET Qt5::Core
        PROPERTY
          INTERFACE_POSITION_INDEPENDENT_CODE ON
  )

  if (WIN32 AND NOT Qt5_NO_LINK_QTMAIN)
      set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
      set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
      set(_isNotExcluded $<NOT:$<BOOL:
$<TARGET_PROPERTY:Qt5_NO_LINK_QTMAIN>>>)
      get_target_property(_configs Qt5::Core IMPORTED_CONFIGURATIONS)
      foreach(_config ${_configs})
          set_property(TARGET Qt5::Core APPEND PROPERTY
              IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
                  $<$<AND:${_isExe},${_isWin32},
${_isNotExcluded}>:Qt5::WinMain>
          )
      endforeach()
      unset(_configs)
      unset(_isExe)
      unset(_isWin32)
      unset(_isNotExcluded)
  endif()
  # End upstreamed stuff.






More information about the cmake-developers mailing list