[CMake] How to create a custom solution with Visual Studio 2010 generator?

Golebiewski, Jakub Jakub.Golebiewski at dnvgl.com
Tue Sep 22 01:39:15 EDT 2015


This may be a solution, I will check this asap.

This should be clearer, I have something like this:

Main Project - PROJECT()
                \Sub Project 1 - PROJECT()
                               \target 1 - ADD_LIBRARY()
                               \target 2 - ADD_LIBRARY()
                \Sub Project 2 - PROJECT()
                               \target 3 - ADD_LIBRARY()
                               \target 4 - ADD_LIBRARY()
                \Sub Project 3 - PROJECT()
                               \target 5 - ADD_LIBRARY()
                               \target 6 - ADD_LIBRARY()

Targets  5 and 6 depend on 1, 2, 3 and 4.

Now when I run cmake on Main Project I will get .sln files for Main Project and each Sub Project.
.sln file for Sub Project 3 will contain all the targets (So I will get .sln with projects for target 1 – 6 in VS terminology).
What I need to have is for Sub Project 3 to have only target 5 and target 6 in .sln without dependencies from other Sub Projects.

So I worry that with your solution I will get unknown targets error? Is there any way to ignore missing targets errors?

Thanks for help,
JG

-----Original Message-----
From: J Decker [mailto:d3ck0r at gmail.com]
Sent: Monday, September 21, 2015 4:50 PM
To: Golebiewski, Jakub
Cc: cmake at cmake.org
Subject: Re: [CMake] How to create a custom solution with Visual Studio 2010 generator?

CMake's PROJECT directive maps to 'Solution'  (should only be one
project() per chain) ... use set( PROJECT projectname) and then reference ${PROJECT} later instead of ${PROJECT_NAME} for easy conversion.

add_library, add_executable map to 'project'

from http://www.cmake.org/Wiki/CMake_Useful_Variables

you can wrap the projects you want to omit with If's

if( NOT MSVC10 )
   add_library( one I don't want in 2010) endif( NOT MSVC10 )




On Sun, Sep 20, 2015 at 11:20 PM, Golebiewski, Jakub <Jakub.Golebiewski at dnvgl.com> wrote:
> Hi,
>
>
>
> I’m trying to create a solution with custom set of projects (in VS
> sense) for Visual Studio 2010.
>
> I have a top level CMakeLists.txt with PROJECT() declared and then
> several CMakeLists.txt below in a tree also with PROJECT() in each of them.
>
> However for lower level PROJECT() directives I get all the targets
> that I specify in CMakeLists.txt and all the targets that they depend on.
>
>
>
> My goal is to have a solution only with a specific set of targets,
> without dependencies.
>
>
>
> Is there a  way to do that in cmake?
>
>
>
> Thanks for help,
>
> Jakub
>
>
> **********************************************************************
> **************** This e-mail and any attachments thereto may contain
> confidential information and/or information protected by intellectual
> property rights for the exclusive attention of the intended addressees
> named above. If you have received this transmission in error, please
> immediately notify the sender by return e-mail and delete this message
> and its attachments. Unauthorized use, copying or further full or
> partial distribution of this e-mail or its contents is prohibited.
> **********************************************************************
> ****************
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For
> more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

**************************************************************************************
This e-mail and any attachments thereto may contain confidential information and/or information protected by intellectual property rights for the exclusive attention of the intended addressees named above. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Unauthorized use, copying or further full or partial distribution of this e-mail or its contents is prohibited.
**************************************************************************************


More information about the CMake mailing list