> This is because we should really only allow one project command per > CMakeLists.txt file, but since we do not error out, it's difficult to > change at this point in time... > > --build uses the CMAKE_PROJECT_NAME cache variable to decide what sln file > to use, and that corresponds to the first project command. > > Do you need multiple project commands in your CMakeLists.txt file? > > What benefit do you get from it? > > I'd like to understand how people are using multiple project commands, so > we can fix this the "right" way.
At my last employer we used multiple projects, too. But every CMakeLists.txt had at most one project(). We had a large number of libraries that had many dependencies regarding their include directories and so on. Also they could be used to build different parts of the software more or less standalone. So what we did was to use the add_subdirectory_once() macro I posted here a few time which does what add_subdirectory() does but will just do nothing if the given directory is already part of the build. And later we did things like include_directories(${LIB1_SOURCE_DIR}/include) to easily get the includes without too much relative paths. Eike -- 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