[CMake] Cmake and Visual Studio platforms
David Cole
dlrdave at aol.com
Fri Mar 1 11:08:41 EST 2013
I understand what you’re asking, and the part that won’t work (in the *general* case) is configuring with two different compilers and two different CMake generators in the *same* directory.
If you configure/generate in two separate directories, and then merge the resulting generated project files into a set of project files that have multiple architecture references in them, that would be more likely to succeed than what you suggest. That would be a whole separate bundle of work, with its own set of challenges.
Either way, what you’re asking for is a significant chunk of re-work. It is not as simple as it sounds like you imagine it to be...
The CMakeCache.txt, configure_file output in the build tree, generated files, and more (all of which may have differences in them due to switching from 32-bit to 64-bit compilers) either have to be avoided or accounted for, in order to make a scheme like this work. It’s possible, but it does not exist right now, and the work required to make it happen is fairly significant (i.e., I don’t see how you could do it with less than *months* of effort).
Like I said, a noble and worth idea, but quite some work to see it through.
Good discussion. 😊
Cheers,
David
From: Meteorhead
Sent: March 1, 2013 10:43 AM
To: cmake at cmake.org
Subject: Re: [CMake] Cmake and Visual Studio platforms
Hi David!
We either misunderstand each other, or my knowledge of CMake is too limited,
but let me try to clarify this one last time, and if you still say it cannot
work, I'll leave it at that:
1) I configure my project using Win32 with output dir A. In this directory
every intermediate test and result is cached that were needed to configure
my project.
2) I press generate, and the actual project and solution files are assembled
in a temp directory (or in memory).
2.5) NEW Prior to writing data on disk, CMake checks whether there are
project/solution files with the name that it wishes to create. Sees that the
target dir A is empty, and ultimately they are written to disk.
3) After this I close my previous session of CMake, open a new one with the
x64 compiler toolset and try to configure my project using the Win64
generator to the same dir A. CMake sees that all cached variables are saved
with a different compiler, and as you say, they become invalidated. So far,
so good, I do not care about cached variables being invalidated, because my
generated Win32 project file is already complete and written to disk.
4) I press generate, again in a temp dir (or in memory) my x64 project and
solution files are assembled, and are ready to be written to disk.
4.5) NEW CMake checks whether there are project/solution files with the name
that it wishes to create. It sees that there are files already inside dir A,
opens them, checks the platform and if it is the same it is actually trying
to write, it will overwrite normally. If the platform found on the disk is
different than the one it tries to write, it makes the aforementioned
insertions into the xml code and tadaaaa: I got my multi-platform VS
solution.
As far as I see no great refactoring is needed to be done in CMake. The only
part where this could fail, is that using a new generator (and compiler) in
the same dir A that already contains generated project files is wiped right
at the beginning of the process. Since cached variables outlive a certain
configuration/generation process, I suspect that the generated Make/IDE
files do too, and they are only overwritten in this final step. (Tested:
true)
I have not seen CMake source code ever in my life, but I know that the
previous Make/IDE files remain the same until the very last step of
"Generate" when they are overwritten. This very last part would need to be
altered in the sole case of VS project generators.
If CMake developers say that the code is simply not structured like that, or
it is too much work to rewrite these parts (and a few others that might
depend on it), then I leave this subject be and not bother again with it.
--
View this message in context: http://cmake.3232098.n2.nabble.com/Cmake-and-Visual-Studio-platforms-tp7583415p7583442.html
Sent from the CMake mailing list archive at Nabble.com.
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130301/c208602b/attachment-0001.htm>
More information about the CMake
mailing list