On Tue, Nov 8, 2011 at 12:08 PM, Tom Deblauwe <tom.debla...@traficon.com> wrote: > Hello, > > I have 2 build configurations for the same source code and I am generating > visual studio 2005 projects. So for the first configuration I need different > defines than for the second configuration. So I do like this: > > mkdir build1 > cd build1 > cmake -DPORT=bla ../source > mkdir build2 > cd build2 > cmake -DPORT=foo ../source > > This generates 2 visual studio 2005 solutions, one in build1 and one in > build2. Now there are two project files and two solutions and each has one > configuration. However I am porting existing code and the old habit was that > the two build configurations were in the same .vcproj and .sln file so you > could easily switch between the two configurations in visual studio. Are > there any cmake ways to make this happen, so to have one project with all the > configs? >
One option would be to use cmake to make a copy of yoru source files to a destination in the binary directory; then build a sepeerate project with the flags set appropriately, but still generate one solution. This lets different CFLAGS be defined per project, and use the same sources; something like.... FOREACH(SOURCE ${SACK_PLUSPLUS_SOURCES}) EXECUTE_PROCESS(COMMAND cmake -E copy_if_different ${PROJECT_SOURCE_DIR}/${SOURCE} ${CMAKE_BINARY_DIR}/${BASENAME}.cpp ) ENDFOREACH(SOURCE) > Best regards, > Tom, > -- > > 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