[CMake] Location of ui and moc generated files (qt)

Torsten Martinsen tma at gatehouse.dk
Wed Aug 15 02:35:35 EDT 2007


Maik Keller <mailto:atracks at gmx.de> wrote:

> Thanks Torsten. I just tested it, and it seems to work with
> CMAKE_CURRENT_SOURCE_DIR. Would it be possible to provide me with
> your implementation of the AIS_MOC macro as well?  

Here it is:

# Run Qt MOC on a C++ header file.
# Arguments:
#    1-N   Names of headerfiles
MACRO(AIS_MOC)
   FOREACH (it ${ARGN})
      # Make .h filename absolute
      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)

      # Build x_moc.cpp filename
      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_moc.cpp)

      # Run MOC
      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
         COMMAND ${QT_MOC_EXECUTABLE}
            ARGS ${infile} -o ${outfile}
	 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
	 DEPENDS ${infile}
	 COMMENT MOCing ${it})
      LIST(APPEND CPP_SOURCE ${outfile})
      LIST(APPEND AIS_MOC_SOURCES ${outfile})
   ENDFOREACH(it)
ENDMACRO(AIS_MOC)

This e-mail and any files sent with it contain information that may be privileged or confidential and is the property of the GateHouse Group. This information is intended solely for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use the message or any part thereof. If you have received this e-mail in error, please notify the sender immediately, and delete all copies of this message. In accordance with GateHouse Security Policy, e-mails sent or received may be monitored. 


More information about the CMake mailing list