[CMake] Possible to get target's _GUID_CMAKE value at cmake time?

zkhan zamir.khan at gmail.com
Thu Mar 14 13:43:22 EDT 2013


I'm still learning (or hacking) my way around using CMake and I've had some
success in attempting to integrate a C# csproj as part of our larger CMake
build with mostly C++ and some C++/CLI projects. This is to build a solution
file for Visual Studio 2008. I am doing some customization of the csproj
file using the configure_file command (to have it reference the correct
dependencies, depending on the type of build) and the including it using
include_external_msproject and so far I feel I've made decent progress.

One last hurdle that I need to cross is that there are ProjectReference
nodes in the csproj file referencing C++/CLI projects. These nodes include a
GUID value that so far I have populated with a static value. However, this
obviously results in a mismatch between the GUID value in the
ProjectReference node and the actual project's GUID value after every new
CMake build and VisualStudio does not like this (the csproj's build fails). 

What I would like to do is, at CMake time, find out (perhaps using
get_property) the GUID value that CMake has (or intends to) generate for my
target vcproj's and put this into the csproj file's respective
ProjectReference node. If I am able to do this, that should solve the build
issue.

So my questions:
1) Is it possible for me to get the ${target}_GUID_CMAKE property at cmake
time? If so, please help me with the command syntax. I've tried this without
success:

get_property(MY_GUID_VARIABLE CACHE INTERNAL PROPERTY targetName_GUID_CMAKE) 

2) Is there a better way to accomplish what I'm trying to do? Feel free to
suggest alternatives.



--
View this message in context: http://cmake.3232098.n2.nabble.com/Possible-to-get-target-s-GUID-CMAKE-value-at-cmake-time-tp7583648.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list