[CMake] COMPILE_FLAGS
Kishore, Jonnalagadda (IE10)
Kishore.Jonnalagadda at honeywell.com
Tue Mar 27 23:48:27 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()
I was doing the same thing except that I was not using the command
SEPARATE_ARGUMENTS. I added that and now the command does not fail. I
checked the command execution with VERBOSE=1 and notice that backslashes
still exist but not in a way to cause the command to fail.
SEPARATE_ARGUMENTS in this contect does not make much sense to me. The
description says it replaces the space between arguments with
semi-colons. I don't want semicolons or the command would consider it
the start of a new command. Yet it works as expected! :-)
Warm regards,
Kishore
More information about the CMake
mailing list