2011/7/12 Laszlo Papp <lp...@kde.org>: > Hi, > > I have just realized this snippet in my CMakeLists.txt file: > > install(FILES > atticamanager.h > authentication.h > > DESTINATION ${INCLUDE_INSTALL_DIR}/gluon/player/lib > COMPONENT Devel > ) > > install(FILES > archive/archive.h > > DESTINATION ${INCLUDE_INSTALL_DIR}/gluon/player/lib/archive > COMPONENT Devel > ) > > install(FILES > models/commentitemsmodel.h > models/gameitemsmodel.h > models/highscoresmodel.h > DESTINATION ${INCLUDE_INSTALL_DIR}/gluon/player/lib/models > COMPONENT Devel > ) > > I wonder whether it could be done smarter. In the example above, there > are subfolders like archive, models. It could also contain 5-10 > subfolders (even more) and we install the headers this way: one > separate install section for each subfolder even if we explicitely > write the subfolders all the time, like "archive/archive.h", > "models/commentitemsmodel.h", et cetera.
May be you could put a CMakeLists.txt in each subdir such that: in the parent folder you could: set(SUBDIRS "archive;models;whatever") foreach(SD IN LISTS SUBDIRS) add_subdirectory(${SD}) endforeach() then inside each directory: get_filename_component(CDIR ${CMAKE_CURRENT_SOURCE_DIR} NAME) set(filelist "commentitemsmodel.h gameitemsmodel.h highscoresmodel.h") install(FILES ${filelist} DESTINATION ${INCLUDE_INSTALL_DIR}/gluon/player/lib/${CDIR} COMPONENT Devel) The latest CMakeLists.txt (the one in the subdir) is almost always the same and could be generated with a minimal script. Not sure whether if it's better than your current solution. May be it's a little less painless to write. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ 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