4

There is the following source tree:

*-source
*----subsource
*--------Source1.hpp
*----Source1.hpp

Both files, ./Source1.hpp and ./subsource/Source1.hpp, must be handled by moc. When using automoc it puts output moc files to the same directory with the same name, since it is impossible it overwrites the file.

Qt - 5.2

CMake - 2.8.12

CMake files are rather big, but here is a brief example:

# Main CMakeLists.txt
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)


add_subdirectory("${CMAKE_SOURCE_DIR}/components/Com1" ./Com1)


# Com1 CMakeLists.txt in components/Com1

file(GLOB_RECURSE CPP_FILES source/*.cpp)
add_library(Com1 SHARED ${CPP_FILES})

Any solutions?

Yuki
  • 3,857
  • 5
  • 25
  • 43
  • Could you show your cmake file? It should not put them into the same directory if you do it right, so the question is: how are you doing it now? – László Papp Apr 25 '14 at 20:02
  • You have not updated the relevant parts from your cmake file, i.e. we cannot see how the hpp is used, etc. – László Papp Apr 26 '14 at 09:27
  • 1
    This is all related to automoc. There are no any hpp files in my CMakeLists. – Yuki Apr 26 '14 at 09:40
  • 1
    There is already a [ticket for this](http://public.kitware.com/Bug/view.php?id=12873) in the cmake issue tracker. For some reason, it completely ignored since 2012 :( – Random Citizen Mar 15 '15 at 07:42

1 Answers1

1

The tracker claims this is fixed in CMake 3.6:

http://public.kitware.com/Bug/view.php?id=12873

Gabriel Schreiber
  • 2,166
  • 1
  • 20
  • 33