If you have multiple directories with different Qt dependencies, you can do: find_package(Qt4 REQUIRED) in the top directory, then each sub directory can do something like set(QT_USE_QTOPENGL 1) include(${QT_USE_FILE})
But in your case, its only lib3, so just do it in that CMakeLists.txt file. Clint On Dec 31, 2009, at 6:45 AM, Hicham Mouline wrote: > Hello, > > My toplevel CMakeLists.txt looks like: > > ---------------------------------------------------------------------------- > -------- > PROJECT(...) > > CMAKE_MINIMUM_REQUIRED(VERSION 2.8) > > # Openmp > FIND_PACKAGE(OpenMP) > IF(OPENMP_FOUND) > SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") > ENDIF() > > # Boost > FIND_PACKAGE(Boost) > IF(Boost_FOUND) > INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) > ENDIF() > > # Qt > FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) > INCLUDE(${QT_USE_FILE}) > > INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR}) > > ADD_SUBDIRECTORY(common) > ADD_SUBDIRECTORY(lib1) > ADD_SUBDIRECTORY(lib2) > ADD_SUBDIRECTORY(lib3) > ADD_SUBDIRECTORY(main) > ---------------------------------------------------------------------------- > -------- > > > Using QT_USE_FILE includes Qt headers for all of common, lib1, lib2, lib3. > How can I include and link Qt only for lib3? > > Lib3's CMakeLists.txt looks like: > > ADD_LIBRARY(lib3 STATIC #cpps hpps ipps) > > ADD_DEPENDENCIES(lib3 common) > > TARGET_LINK_LIBRARIES(lib3 ${QT_LIBRARIES}) > > Rds, > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake