[CMake] Source control bindings feature in CMake needs better documentation

Steven Velez sbv1976 at gmail.com
Tue Nov 1 00:19:49 EDT 2011


Hi Robert,

I don't pretend to know everything there is to know about Visual
Studio SCC integration, but I have gotten this to work before with a
bit of trial and error, and reverse-engineering the entries visual
studio creates for these properties.

To answer your most recent question, there is no way to specify
perforce connection/user/workspace information in the cmake file as
these properties are just forwarded to the generated .vcproj files,
and there is no way to set the parameters you are looking for there.

In your examples, [I have found that] the values you have for project
name and provider are correct when hooking up to perforce. However, I
think you are a bit off the mark on the first parameter to
set_target_properties.  This is supposed to be the name of the
_target_ you are binding to scc (the result of a add_executable,
add_library command etc.) not the project name.   In the cmake->VS
mapping, a cmake target is a VS project, and a cmake project is a VS
solution (so if you have a project command for every target, you can
most likely start simplifying things there). I mention this because it
may have something to do with the excessive prompting you are
getting... though reviewing my team's integration shows that we are
doing this same thing.  Another thing you might want to adjust is the
local path.... I have had the most success with passing a path
relative to the target's binary directory using the target path format
(in this case, always windows... i.e. use back slashes.  To compute
this dynamically, you may have success using file(RELATIVE_PATH) with
CMAKE_CURRENT_BINARY_DIR, and CMAKE_SOURCE_DIR.  In VS2010, at least,
we have found that in order to avoid being prompted to save on exit,
we must strip trailing slashes from the path we build in this way.

Following this pattern, we have gotten to the point where we are
prompted once for port and workspace/clientspec on each invocation of
visual studio, but it is only once and not once per project in the
solution.

Steven

On Mon, Oct 31, 2011 at 2:36 PM, Robert Dailey <rcdailey at gmail.com> wrote:
> While waiting on a response I did some experimentation:
>
> set_target_properties(
> "${project_name}" PROPERTIES
> VS_SCC_LOCALPATH "${CMAKE_SOURCE_DIR}"
> VS_SCC_PROJECTNAME "Perforce Project"
> VS_SCC_PROVIDER "MSSCCI:Perforce SCM"
> )
> This seems to work in VS 2003 but the annoying thing is that when I open the
> solution, every single project (about 120 of them) each prompt me for my
> username, workspace, and server URL to perforce server.
> Is there no way to specify this connection/user/workspace information in
> CMake so that when I open the solution it already knows this stuff?
> ---------
> Robert Dailey
>
>
> On Mon, Oct 31, 2011 at 12:24 PM, Robert Dailey <rcdailey at gmail.com> wrote:
>>
>> Hey guys,
>> Our team is running Perforce here at work and I want to setup any Visual
>> Studio projects generated to use source control bindings for Perforce.
>> The documentation for VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH,
>> VS_SCC_PROVIDER is pretty bad and I really have no clue on how to use these.
>> Could someone explain what each is and possibly provide some examples on how
>> they are used for Perforce?
>> Thanks!!
>>
>> ---------
>> Robert Dailey
>
>
> --
>
> 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
>


More information about the CMake mailing list