View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005230CMakeModulespublic2007-06-24 06:542016-06-10 14:30
ReporterIsaac Clerencia 
Assigned ToClinton Stimpson 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005230: qt4_automoc generates .moc files in CMAKE_CURRENT_BINARY_DIR
DescriptionI'm not sure if this is "by-design" but it's causing me problems.

I have a src/ dir with two class hierarchies in two subdirs src/event/ and src/action/ . Both event/ and action/ have a base.cc which must be moc'ed.

When running qt4_automoc over event/base.cc and action/base.cc both base.moc files are created in src/ which causes a name clash. I've modified the FindQt4.cmake file to generate the moc files inside the directories (just like the .o files are generated) and everything works ok now.

Any reason to not change that? In that case, any other workaround?
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0007949)
Isaac Clerencia (reporter)
2007-06-27 12:55

My "fix" has been to change the inner loop in qt4_automoc to: GET_filename_component(_basename ${_current_MOC} NAME_WE)
SET(_header ${_abs_PATH}/${_basename}.h)
SET(_moc ${_abs_PATH}/${_basename}.moc)
ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
    COMMAND ${QT_MOC_EXECUTABLE}
    ARGS ${_moc_INCS} ${_header} -o ${_moc}
    DEPENDS ${_header}
)
(0008038)
Alex Neundorf (developer)
2007-07-12 10:04

With your change the moc files are generated in the source directory. This breaks out-of-source builds (you can have multiple out-of-source builds for one source tree).

You can exclude one of the two files from automoc by generating the moc file for it explicitely:

qt4_generate_moc(event/base.h ${CMAKE_CURRENT_BINARY_DIR}/moc_event_base.cpp)

and add this moc_event_base.cpp to the sources of your target.

Alex


(0008072)
Isaac Clerencia (reporter)
2007-07-15 10:20

Ok, I'll use that.

Anyway, if I have sources in dir/ and more sources in dir/subdir/, and I add an executable in dir like:
add_executable(foo foo.c subdir/bar.c)
in the builddir I get a "CMakefiles/foo.dir/" which includes a "subdir/" directory where the bar.o object ends up.

Wouldn't make sense for qt4_automoc to behave the same way and use a subdir in the build directory?

Best regards
(0013870)
Alex Neundorf (developer)
2008-10-13 19:21

Assigning this to Clinton, since he is maintaining FindQt4.cmake

Alex
(0013879)
Clinton Stimpson (developer)
2008-10-14 17:24

Can you please post an example that demonstrates the problem?
(0041373)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2007-08-23 14:02 Alex Neundorf Category CMake => Modules
2008-10-13 19:21 Alex Neundorf Note Added: 0013870
2008-10-13 19:21 Alex Neundorf Assigned To Alex Neundorf => Clinton Stimpson
2008-10-14 17:24 Clinton Stimpson Note Added: 0013879
2012-08-13 23:25 Clinton Stimpson Status assigned => backlog
2016-06-10 14:27 Kitware Robot Note Added: 0041373
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team