[CMake] Replace `ctest` command with `ctest --output-on-failure`

2016-04-19 Thread Muhammad Osama
Hi,

Is there a way I can replace ctest command with ctest --some-flag in
CMakeLists.txt? So, when my users run cmake, make and ctest. They are
actually performing cmake, make and ctest --some-flag? I don't want them to
worry about the flag and just type ctest.

Thank you,
-- 
*Muhammad Osama*
-- 

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

Re: [CMake] CMakeLists.txt: How to print a message if ctest fails?

2016-04-19 Thread Muhammad Osama
Hi Miroslav,

That makes sense, is there a way I can make  ctest -S CTestScript.cmake command
replace the regular ctest? I don't want users who run ctest type the whole
thing.

Thank you,

On Tue, Apr 19, 2016 at 1:18 AM, Matějů Miroslav, Ing. <
mateju.miros...@azd.cz> wrote:

> Hi Muhammad,
>
>
>
> You need to add this code to a separate CTest script (CTestScript.cmake,
> for example) and then run it using ctest -S CTestScript.cmake. Since the
> wiki page I linked yesterday provides only some complex examples, I am
> sending the key part of my CTest script. As you can see, its operation
> strongly depends on environment variables (some of them are provided by
> Windows). You’ll probably need to remove most of my if’s.
>
>
>
> set(CTEST_SOURCE_DIRECTORY "$ENV{SCRIPT_FOLDER}")
>
> set(CTEST_BINARY_DIRECTORY "$ENV{BINARY_PROJECT_FOLDER}")
>
>
>
> set(CTEST_SITE  $ENV{COMPUTERNAME})
>
> set(CTEST_BUILD_NAME$ENV{TEST_CASE_NAME})
>
>
>
> ctest_start()
>
>
>
> ctest_configure(RETURN_VALUE configure_failed)
>
>
>
> if($ENV{DO_UPDATE})
>
>   ctest_update()
>
> endif($ENV{DO_UPDATE})
>
>
>
> if($ENV{DO_BUILD})
>
>   ctest_build(RETURN_VALUE build_failed)
>
> endif($ENV{DO_BUILD})
>
>
>
> if   (($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed))
>
>   ctest_test(RETURN_VALUE test_failed)
>
> endif(($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed))
>
>
>
> if($ENV{DO_DASHBOARD})
>
>   ctest_submit()
>
> endif($ENV{DO_DASHBOARD})
>
>
>
> if   (configure_failed OR build_failed OR test_failed)
>
>   message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")  # sets return
> value to -1
>
> endif(configure_failed OR build_failed OR test_failed)
>
>
>
> Best regards,
>
> Miroslav
>
>
>
> *From:* Muhammad Osama [mailto:osam...@gmail.com]
> *Sent:* Monday, April 18, 2016 8:33 PM
> *To:* Matějů Miroslav, Ing.
> *Cc:* cmake@cmake.org
> *Subject:* Re: [CMake] CMakeLists.txt: How to print a message if ctest
> fails?
>
>
>
> Hi Miroslav,
>
>
>
> Thank you for replying! I added this in my root CMakeLists.txt, purposely
> made the ctest's test fail but didn't get the output message.
>
> Is this script suppose to be added inside CMakeLists.txt? Or am I doing
> this incorrectly?
>
>
>
> Thanks again,
>
>
>
> On Mon, Apr 18, 2016 at 6:30 AM, Matějů Miroslav, Ing. <
> mateju.miros...@azd.cz> wrote:
>
> Hi Muhammad,
>
> you can use a CTest script, see
> https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the
> following code in my CTest script:
>
>
>
> if(configure_failed OR build_failed OR test_failed)
>
> message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")
>
> endif()
>
>
>
> Best regards,
>
> Miroslav
>
>
>
> *From:* CMake [mailto:cmake-boun...@cmake.org] *On Behalf Of *Muhammad
> Osama
> *Sent:* Friday, April 15, 2016 8:53 PM
> *To:* cmake@cmake.org
> *Subject:* [CMake] CMakeLists.txt: How to print a message if ctest fails?
>
>
>
> Is there a way I can setup CMakeLists.txt to print a message if ctest
> tests fail? For example:
>
> cmake ..
> make
> ctest // fails
> message output: Please contact x...@mail.com to resolve testing problems.
>
> ​Note the message output is not for cmake but for ctest.​
>
>
>
> --​​
>
> Muhammad
>
>
>
>
>
> --
>
> *Muhammad*
>



-- 
*Muhammad*
-- 

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

Re: [CMake] CMakeLists.txt: How to print a message if ctest fails?

2016-04-18 Thread Muhammad Osama
Hi Miroslav,

Thank you for replying! I added this in my root CMakeLists.txt, purposely
made the ctest's test fail but didn't get the output message.
Is this script suppose to be added inside CMakeLists.txt? Or am I doing
this incorrectly?

Thanks again,

On Mon, Apr 18, 2016 at 6:30 AM, Matějů Miroslav, Ing. <
mateju.miros...@azd.cz> wrote:

> Hi Muhammad,
>
> you can use a CTest script, see
> https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the
> following code in my CTest script:
>
>
>
> if(configure_failed OR build_failed OR test_failed)
>
> message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")
>
> endif()
>
>
>
> Best regards,
>
> Miroslav
>
>
>
> *From:* CMake [mailto:cmake-boun...@cmake.org] *On Behalf Of *Muhammad
> Osama
> *Sent:* Friday, April 15, 2016 8:53 PM
> *To:* cmake@cmake.org
> *Subject:* [CMake] CMakeLists.txt: How to print a message if ctest fails?
>
>
>
> Is there a way I can setup CMakeLists.txt to print a message if ctest
> tests fail? For example:
>
> cmake ..
> make
> ctest // fails
> message output: Please contact x...@mail.com to resolve testing problems.
>
> ​Note the message output is not for cmake but for ctest.​
>
>
>
> --​​
>
> Muhammad
>



-- 
*Muhammad*
-- 

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

[CMake] CMakeLists.txt: How to print a message if ctest fails?

2016-04-15 Thread Muhammad Osama
Is there a way I can setup CMakeLists.txt to print a message if ctest tests
fail? For example:

cmake ..
make
ctest // fails
message output: Please contact x...@mail.com to resolve testing problems.

​Note the message output is not for cmake but for ctest.​

--​​
Muhammad
-- 

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

Re: [CMake] Create main and sub-projects; be able to compile them together and individually.

2016-03-08 Thread Muhammad Osama
Makes sense, thank you so much Nicholas! I will give this a try.

On Tue, Mar 8, 2016 at 5:19 PM, Nicholas Braden <nicholas11bra...@gmail.com>
wrote:

> Yep, just make each project act independently with no knowledge of the
> superproject, and have the superproject glue it all together as a
> convenience for the user if they don't want to manually build things
> separately or if they don't have existing installs. That's what I am doing
> with my projects.
>
> On Tue, Mar 8, 2016 at 7:17 PM, Muhammad Osama <osam...@gmail.com> wrote:
>
>> Wow, this is powerful! Question; Will I be able to compile the
>> sub-project individually?
>> Because as I see this is what we will use in the root/CMakeLists.txt, but
>> what about the sub-dirs which I really want to be "independent" if the user
>> wants.
>>
>> On Tue, Mar 8, 2016 at 5:13 PM, Nicholas Braden <
>> nicholas11bra...@gmail.com> wrote:
>>
>>> Example simple usages from my personal projects:
>>>
>>> https://github.com/LB--/events/blob/499ba78b923b40f77cc832b6a5d414240209ac96/CMakeLists.txt
>>>
>>> https://github.com/LB--/simple-platformer/blob/1bba3dd2d8ed1cdae74ce1b77c4ab99878fa59a6/CMakeLists.txt
>>>
>>> More complex usage in hunter:
>>> https://github.com/ruslo/hunter
>>>
>>> With ExternalProject you can have it either download from version
>>> control / source archive, or you can use a local existing folder. I think
>>> in your case you just need to point it to your existing project folders and
>>> forward the appropriate arguments. There is a lot of customizability to it
>>> (customizing each step, for example). If you want I could make an example
>>> exactly like your provided example directory structure, but I think both of
>>> my personal usages closely match what you are wanting to do.
>>>
>>> On Tue, Mar 8, 2016 at 7:02 PM, Muhammad Osama <osam...@gmail.com>
>>> wrote:
>>>
>>>> Thank you for your suggestion Nicholas, I have never used
>>>> ExternalProject_Add before and can't find a related example to my project.
>>>> Would you know an example that uses it?
>>>>
>>>> On Tue, Mar 8, 2016 at 10:38 AM, Nicholas Braden <
>>>> nicholas11bra...@gmail.com> wrote:
>>>>
>>>>> Have you looked into ExternalProject_Add? It allows just using a local
>>>>> path instead of downloading a remote repository:
>>>>>
>>>>> https://cmake.org/cmake/help/latest/module/ExternalProject.html
>>>>>
>>>>> On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama <osam...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Jan,
>>>>>>
>>>>>> Thank you for your reply, I am in the similar situation, have a very
>>>>>> similar implementation using *target_*** *but since I don't do that
>>>>>> for ALL the dependencies, I am unable to cmake or compile individual
>>>>>> projects in the sub directories. So, few questions;
>>>>>>
>>>>>> 1. This still requires me to run cmake on the root CMakeLists.txt to
>>>>>> set the flags and what not before I run the sub project to make it 
>>>>>> correct?
>>>>>> 1a. If so, how can I make the CMakeLists.txts in the sub directories
>>>>>> independent of the root one if I want to just compile the sub-project and
>>>>>> not cmake the whole thing?
>>>>>> 2. Another question is that your implementation, does it not include
>>>>>> a config file? In theory you're copy pasting most of the dependencies in
>>>>>> the CMakeLists.txt of root into the sub-dir ones? Is there a better way 
>>>>>> to
>>>>>> do this?
>>>>>>
>>>>>> Thank you!
>>>>>>
>>>>>> On Tue, Mar 8, 2016 at 2:02 AM,  Jan Hegewald <jan.hegew...@awi.de>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Muhammad,
>>>>>>>
>>>>>>> > On 08.03.2016, at 06:17, Muhammad Osama <osam...@gmail.com> wrote:
>>>>>>> >
>>>>>>> > Hi, I am new to cmake and really hope am doing this correctly. I
>>>>>>> asked stackoverflow but didn't get a good enough answer for my specific
>>>>>>> problem here;
>>>>>>> >
>>>>>>> > I

Re: [CMake] Create main and sub-projects; be able to compile them together and individually.

2016-03-08 Thread Muhammad Osama
Wow, this is powerful! Question; Will I be able to compile the sub-project
individually?
Because as I see this is what we will use in the root/CMakeLists.txt, but
what about the sub-dirs which I really want to be "independent" if the user
wants.

On Tue, Mar 8, 2016 at 5:13 PM, Nicholas Braden <nicholas11bra...@gmail.com>
wrote:

> Example simple usages from my personal projects:
>
> https://github.com/LB--/events/blob/499ba78b923b40f77cc832b6a5d414240209ac96/CMakeLists.txt
>
> https://github.com/LB--/simple-platformer/blob/1bba3dd2d8ed1cdae74ce1b77c4ab99878fa59a6/CMakeLists.txt
>
> More complex usage in hunter:
> https://github.com/ruslo/hunter
>
> With ExternalProject you can have it either download from version control
> / source archive, or you can use a local existing folder. I think in your
> case you just need to point it to your existing project folders and forward
> the appropriate arguments. There is a lot of customizability to it
> (customizing each step, for example). If you want I could make an example
> exactly like your provided example directory structure, but I think both of
> my personal usages closely match what you are wanting to do.
>
> On Tue, Mar 8, 2016 at 7:02 PM, Muhammad Osama <osam...@gmail.com> wrote:
>
>> Thank you for your suggestion Nicholas, I have never used
>> ExternalProject_Add before and can't find a related example to my project.
>> Would you know an example that uses it?
>>
>> On Tue, Mar 8, 2016 at 10:38 AM, Nicholas Braden <
>> nicholas11bra...@gmail.com> wrote:
>>
>>> Have you looked into ExternalProject_Add? It allows just using a local
>>> path instead of downloading a remote repository:
>>>
>>> https://cmake.org/cmake/help/latest/module/ExternalProject.html
>>>
>>> On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama <osam...@gmail.com>
>>> wrote:
>>>
>>>> Hi Jan,
>>>>
>>>> Thank you for your reply, I am in the similar situation, have a very
>>>> similar implementation using *target_*** *but since I don't do that
>>>> for ALL the dependencies, I am unable to cmake or compile individual
>>>> projects in the sub directories. So, few questions;
>>>>
>>>> 1. This still requires me to run cmake on the root CMakeLists.txt to
>>>> set the flags and what not before I run the sub project to make it correct?
>>>> 1a. If so, how can I make the CMakeLists.txts in the sub directories
>>>> independent of the root one if I want to just compile the sub-project and
>>>> not cmake the whole thing?
>>>> 2. Another question is that your implementation, does it not include a
>>>> config file? In theory you're copy pasting most of the dependencies in the
>>>> CMakeLists.txt of root into the sub-dir ones? Is there a better way to do
>>>> this?
>>>>
>>>> Thank you!
>>>>
>>>> On Tue, Mar 8, 2016 at 2:02 AM,  Jan Hegewald <jan.hegew...@awi.de>
>>>> wrote:
>>>>
>>>>> Hi Muhammad,
>>>>>
>>>>> > On 08.03.2016, at 06:17, Muhammad Osama <osam...@gmail.com> wrote:
>>>>> >
>>>>> > Hi, I am new to cmake and really hope am doing this correctly. I
>>>>> asked stackoverflow but didn't get a good enough answer for my specific
>>>>> problem here;
>>>>> >
>>>>> > If I want root/sub-directories/ as separate sub-projects that can be
>>>>> compiled using the individualCMakeLists.txts in their folders I find 
>>>>> myself
>>>>> literally copy pasting almost the entire root file CMakeLists.txt per
>>>>> sub-directory.
>>>>> >
>>>>> > I was wondering if there is a better way to have a main project and
>>>>> then sub-projects that get the shared dependencies from main project and
>>>>> can be compiled without cmake-ing the root CMakeLists.txt. My directory
>>>>> structure is;
>>>>> >
>>>>> > CMakeLists.txt (root project)
>>>>> > | __ sub_dir-1
>>>>> > | __ | __ CMakeLists.txt (sub-project)
>>>>> > | __ sub_dir-2
>>>>> > | __ | __ CMakeLists.txt (sub-project)
>>>>> > | __ sub_dir-3
>>>>> > | __ | __ CMakeLists.txt (sub-project)
>>>>>
>>>>> I basically have the same project structure as you describe. I am also
>>>>> not sure what the best practice is here, but this is w

Re: [CMake] Create main and sub-projects; be able to compile them together and individually.

2016-03-08 Thread Muhammad Osama
Thank you for your suggestion Nicholas, I have never used
ExternalProject_Add before and can't find a related example to my project.
Would you know an example that uses it?

On Tue, Mar 8, 2016 at 10:38 AM, Nicholas Braden <nicholas11bra...@gmail.com
> wrote:

> Have you looked into ExternalProject_Add? It allows just using a local
> path instead of downloading a remote repository:
>
> https://cmake.org/cmake/help/latest/module/ExternalProject.html
>
> On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama <osam...@gmail.com> wrote:
>
>> Hi Jan,
>>
>> Thank you for your reply, I am in the similar situation, have a very
>> similar implementation using *target_*** *but since I don't do that for
>> ALL the dependencies, I am unable to cmake or compile individual projects
>> in the sub directories. So, few questions;
>>
>> 1. This still requires me to run cmake on the root CMakeLists.txt to set
>> the flags and what not before I run the sub project to make it correct?
>> 1a. If so, how can I make the CMakeLists.txts in the sub directories
>> independent of the root one if I want to just compile the sub-project and
>> not cmake the whole thing?
>> 2. Another question is that your implementation, does it not include a
>> config file? In theory you're copy pasting most of the dependencies in the
>> CMakeLists.txt of root into the sub-dir ones? Is there a better way to do
>> this?
>>
>> Thank you!
>>
>> On Tue, Mar 8, 2016 at 2:02 AM,  Jan Hegewald <jan.hegew...@awi.de>
>> wrote:
>>
>>> Hi Muhammad,
>>>
>>> > On 08.03.2016, at 06:17, Muhammad Osama <osam...@gmail.com> wrote:
>>> >
>>> > Hi, I am new to cmake and really hope am doing this correctly. I asked
>>> stackoverflow but didn't get a good enough answer for my specific problem
>>> here;
>>> >
>>> > If I want root/sub-directories/ as separate sub-projects that can be
>>> compiled using the individualCMakeLists.txts in their folders I find myself
>>> literally copy pasting almost the entire root file CMakeLists.txt per
>>> sub-directory.
>>> >
>>> > I was wondering if there is a better way to have a main project and
>>> then sub-projects that get the shared dependencies from main project and
>>> can be compiled without cmake-ing the root CMakeLists.txt. My directory
>>> structure is;
>>> >
>>> > CMakeLists.txt (root project)
>>> > | __ sub_dir-1
>>> > | __ | __ CMakeLists.txt (sub-project)
>>> > | __ sub_dir-2
>>> > | __ | __ CMakeLists.txt (sub-project)
>>> > | __ sub_dir-3
>>> > | __ | __ CMakeLists.txt (sub-project)
>>>
>>> I basically have the same project structure as you describe. I am also
>>> not sure what the best practice is here, but this is what I currently do:
>>> I set all dependencies where they are required: right in the local
>>> CMakeLists.txt, i.e. sub_dir-1/CMakeLists.txt. Then "export" all required
>>> include/define/compiler flags dependencies via INTERFACE or PUBLIC flags of
>>> the various target_*** cmake functions, as appropriate. The sub-projects
>>> are added via add_subdirectory in cmake.
>>> This way I can build each CMakeLists.txt individually if needed but
>>> still have everything DRYish.
>>>
>>> HTH,
>>> Jan
>>>
>>> --
>>>
>>> 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
>>>
>>
>>
>>
>> --
>> *Muhammad Osama*
>> Graduate Student
>> Department of Electrical and Computer Engineering
>> University of California, Davis
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>>

Re: [CMake] Create main and sub-projects; be able to compile them together and individually.

2016-03-08 Thread Muhammad Osama
Hi Jan,

Thank you for your reply, I am in the similar situation, have a very
similar implementation using *target_*** *but since I don't do that for ALL
the dependencies, I am unable to cmake or compile individual projects in
the sub directories. So, few questions;

1. This still requires me to run cmake on the root CMakeLists.txt to set
the flags and what not before I run the sub project to make it correct?
1a. If so, how can I make the CMakeLists.txts in the sub directories
independent of the root one if I want to just compile the sub-project and
not cmake the whole thing?
2. Another question is that your implementation, does it not include a
config file? In theory you're copy pasting most of the dependencies in the
CMakeLists.txt of root into the sub-dir ones? Is there a better way to do
this?

Thank you!

On Tue, Mar 8, 2016 at 2:02 AM,  Jan Hegewald <jan.hegew...@awi.de> wrote:

> Hi Muhammad,
>
> > On 08.03.2016, at 06:17, Muhammad Osama <osam...@gmail.com> wrote:
> >
> > Hi, I am new to cmake and really hope am doing this correctly. I asked
> stackoverflow but didn't get a good enough answer for my specific problem
> here;
> >
> > If I want root/sub-directories/ as separate sub-projects that can be
> compiled using the individualCMakeLists.txts in their folders I find myself
> literally copy pasting almost the entire root file CMakeLists.txt per
> sub-directory.
> >
> > I was wondering if there is a better way to have a main project and then
> sub-projects that get the shared dependencies from main project and can be
> compiled without cmake-ing the root CMakeLists.txt. My directory structure
> is;
> >
> > CMakeLists.txt (root project)
> > | __ sub_dir-1
> > | __ | __ CMakeLists.txt (sub-project)
> > | __ sub_dir-2
> > | __ | __ CMakeLists.txt (sub-project)
> > | __ sub_dir-3
> > | __ | __ CMakeLists.txt (sub-project)
>
> I basically have the same project structure as you describe. I am also not
> sure what the best practice is here, but this is what I currently do:
> I set all dependencies where they are required: right in the local
> CMakeLists.txt, i.e. sub_dir-1/CMakeLists.txt. Then "export" all required
> include/define/compiler flags dependencies via INTERFACE or PUBLIC flags of
> the various target_*** cmake functions, as appropriate. The sub-projects
> are added via add_subdirectory in cmake.
> This way I can build each CMakeLists.txt individually if needed but still
> have everything DRYish.
>
> HTH,
> Jan
>
> --
>
> 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
>



-- 
*Muhammad Osama*
Graduate Student
Department of Electrical and Computer Engineering
University of California, Davis
-- 

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

[CMake] Fwd: Create main and sub-projects; be able to compile them together and individually.

2016-03-07 Thread Muhammad Osama
Hi, I am new to cmake and really hope am doing this correctly. I asked
stackoverflow but didn't get a good enough answer for my specific problem
here;

If I want root/sub-directories/ as separate sub-projects that can be
compiled using the individualCMakeLists.txts in their folders I find myself
literally copy pasting almost the entire root file CMakeLists.txt per
sub-directory.

I was wondering if there is a better way to have a main project and then
sub-projects that get the shared dependencies from main project and can be
compiled without cmake-ing the root CMakeLists.txt. My directory structure
is;

CMakeLists.txt (root project)
| __ sub_dir-1
| __ | __ CMakeLists.txt (sub-project)
| __ sub_dir-2
| __ | __ CMakeLists.txt (sub-project)
| __ sub_dir-3
| __ | __ CMakeLists.txt (sub-project)
...

Essentially, I want to be able to:

1.
​ ​
cmake root/CMakeLists.txt, which creates an entire project that includes
the sub-projects (I already have this implemented using individual
CMakeLists.txts inside sub-directories.

2.
​ ​
cmake root/sub-dir/CMakeLists.txt and only compile the sub-project, which
essentially also finds the necessary dependencies and includes them from
maybe .cmake includes or root/CMakeLists.txt. What is the best way to
approach this structure;

while retaining the first bullet point of having the ability to compile it
as an entire project.
And also not crowding the sub-dir/CMakeLists.txt too much with redundant
code?

Appreciate any suggestions! Thank you.


--
Muhammad Osama
-- 

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