Hello folks, I had a question a long time ago about the qt4_wrap_cpp and the target_include_directories commands.
To explain the problem, I wanted to use target_include_directories to add include directories to dependent target easier. However I really wanted to use qt4_wrap_cpp and not AUTOMOC (just to understand what happens under the hood). But the problem, is that qt4_wrap_cpp also needs the include directories, and to add the include directories you must create a target with source files, so you're stuck because you can't add the source of qt4_wrap_cpp after. So I heard that qt4_wrap_cpp has a TARGET option that specify a target even if it does not currently exist. So that solve my problem: # a/CMakeLists.txt # A library that add a lots of include directories add_library(A SHARED foo.cpp) target_include_directories(foo PUBLIC a/ b/ c/ d/) And now the executable that requires `A' but use qt4_wrap_cpp before. # CMakeLists.txt qt4_wrap_cpp(output myheader.h TARGET exe) add_executable(exe ${output} main.cpp) target_link_libraries(exe A) Then the qt4_wrap_cpp seems to work and use the include directories from A. Is this the correct behavior ? If it's correct, I must say that the TARGET option is not shown in the qt4_wrap_cpp macro defined in the help message of FindQt4 module. Kind regards, -- Demelier David -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake