[CMake] COMPILE_FLAGS

Filipe Sousa natros at gmail.com
Tue Mar 27 16:44:57 EST 2007


Kishore, Jonnalagadda (IE10) wrote:
>> KJI> This would have worked just fine except that INCLUDE_DIRECTORIES
>> returns
>> KJI> semicolon separated list of directory names not a space separated
>> list
>>
>> Seems to be true for any list oft values as I experienced also. Is it
>> true content or only the formatting of the MESSAGE() command?
> 
> Hmmm... You are right. It seems to be the formatting of the message
> command. My problem was with including the definitions part. Generally
> speaking, it seems to be a problem with cmake introducing backslashes in
> the command. In my case, the command failed with including the
> definitions. I do not have a clear idea of the pattern in which the
> backslashes are introduced.
> 
> Warm regards,
> Kishore

You must be doing something wrong. I have been using this macro for ages:
MACRO(QT_ADD_MOC output)
  GET_DIRECTORY_PROPERTY(_flags DEFINITIONS)
  SEPARATE_ARGUMENTS(_flags)

  GET_DIRECTORY_PROPERTY(_includes INCLUDE_DIRECTORIES)
  FOREACH(_dir ${_includes})
    LIST(APPEND _flags ${CMAKE_INCLUDE_FLAG_CXX}${_dir})
  ENDFOREACH()

  FOREACH(_header_file ${ARGN})
    GET_FILENAME_COMPONENT(_header_file ${_header_file} ABSOLUTE)
    GET_FILENAME_COMPONENT(_basename ${_header_file} NAME_WE)
    SET(_moc_file ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp)
    ADD_CUSTOM_COMMAND(
      OUTPUT  ${_moc_file}
      COMMAND ${QT_MOC_EXECUTABLE} ${_flags} -o ${_moc_file} ${_header_file}
      DEPENDS ${_header_file}
      )
    LIST(APPEND ${output} ${_moc_file})
  ENDFOREACH()
ENDMACRO()


--
Filipe Sousa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20070327/0941a001/signature.pgp


More information about the CMake mailing list