[CMake] Multiple Visual Studio Solutions through same master CMakeLists.txt

Nikita Barawade nikita.barawade at einfochips.com
Thu Jan 28 07:03:07 EST 2016



Hi,

Thanks Nils !

Regards,
Nikita


________________________________
From: Nils Gladitz <nilsgladitz at gmail.com>
Sent: 28 January 2016 05:27 PM
To: Nikita Barawade; cmake at cmake.org
Subject: Re: [CMake] Multiple Visual Studio Solutions through same master CMakeLists.txt



On 01/28/2016 12:42 PM, Nikita Barawade wrote:



Hi All ,

It is possible to same master CMakeList to generate multiple visual studio solution files ?

here is my master CMakeList :

cmake_minimum_required (VERSION 2.8.11)
project (Myproject_all)

set_property (GLOBAL PROPERTY USE_FOLDERS ON)

# Set compiler flags and options.
# enable the Visual Studio warning level to 4
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")

# Sub-directories where more CMakeLists.txt exist
add_subdirectory (lib1)
add_subdirectory (TestApp1)
add_subdirectory (lib2)
add_subdirectory (TestApp2)
add_subdirectory (TestApp3)

Now , my project "Myproject_all" includes all sub-projects as lib1,TestApp1,lib2,TestApp2,TestApp3 (testApps depend on libraries )
I want another solution to be generated through same CMakeList for example with name "Myproject" which includes only ,
lib1,TestApp1,lib2.
I should not always edit master CMakeList to change project name and remove TestApp2 and TestApp3.Is there any way to automate this?

CMake generates one solution per directory (CMakeLists.txt) that has its own project() call.
To put lib1,TestApp1,lib2 into their own solution you would therefor have to put them into a common parent directory (distinct from the other targets) and give that parent directory's CMakeLists.txt its own project(Myproject) call.

Nils
************************************************************************************************************************************************************* eInfochips Business Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. *************************************************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160128/3ae8548c/attachment.html>


More information about the CMake mailing list