Re: [CMake] Disabling INSTALL target for subdirectory

2017-02-16 Thread Milan Ziegler
Hi Florent,



thank you so much. EXCLUDE_FROM_ALL does indeed have the effect of
ignoring any install() invocations from within the subdirectory. I
remember stumbling across this option, but from the docs I didn't get
the impression that this would affect the installation as well.


Maybe the documentation needs a few more words here.



> 

> Also, 3rdparty libraries should be tagged like that anyway to be built
> only when they are used by the main targets.
Yes, this is a good idea.





Thanks again,

Milan





--

  Milan Ziegler

  mi...@fastmail.com







On Thu, Feb 16, 2017, at 13:33, Florent Castelli wrote:

> Use add_subdirectory(...  EXCLUDE_FROM_ALL) to prevent anything in
> there to be installed by default.
> I had the issue in one project and it did fix it for us. 

> 

> Also, 3rdparty libraries should be tagged like that anyway to be built
> only when they are used by the main targets.
> 

> /Florent 

> 

> On Feb 16, 2017 07:59, "Milan Ziegler"  wrote:

>> Hi,

>> 

>>  we are using the CMake install mechanism "install(...)" to copy all
>>  relevant files and target binaries of the product into the CMake
>>  install
>>  prefix folder, for further packaging. So far so good.

>> 

>>  We are also using several thirdparty libraries, hosting them
>>  inside our
>>  own repository and building them along with our own code,
>>  usually using
>>  add_subdirectory utilizing their native CMake buildsystem.

>> 

>>  Turns out, other developers also like the CMake install mechanism.

>> 

>>  So now the INSTALL target of our whole project also installs
>>  thirdparty
>>  components, which we do not want to deliver with our own product
>>  (think
>>  static libraries, which are already linked into our executable).

>> 

>>  After a lot of googling, here's my question: Is there a clean way to
>>  disable the install target for a subdirectory _without_ also
>>  disabling
>>  it completely for the remaining project?

>> 

>>  What we already tried:

>>  * Setting CMAKE_INSTALL_PREFIX to a temporary directory for the

>>  subdirectory (doesn't work)

>>  * "function(install) endfunction()" to disable the install
>>function for
>>  the subdirectory (breaks CMake in hilarious ways)

>> 

>>  What we now do:

>>  Using a custom target, we patch the cmake_install.cmake files in the
>>  build directories before installing (works, but it's an
>>  abomination of
>>  a hack)

>> 

>>  Any help? I think it's a valid usecase for CMake but there
>>  doesn't seem
>>  to be an easy way to do it.

>> 

>>  We are using CMake 3.5.

>> 

>> 

>>  Thank you :)

>> 

>>  --

>>Milan

>>mi...@fastmail.com

>>  --

>> 

>>  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


-- 

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] Disabling INSTALL target for subdirectory

2017-02-16 Thread Florent Castelli
Use add_subdirectory(...  EXCLUDE_FROM_ALL) to prevent anything in there to
be installed by default.
I had the issue in one project and it did fix it for us.

Also, 3rdparty libraries should be tagged like that anyway to be built only
when they are used by the main targets.

/Florent

On Feb 16, 2017 07:59, "Milan Ziegler"  wrote:

> Hi,
>
> we are using the CMake install mechanism "install(...)" to copy all
> relevant files and target binaries of the product into the CMake install
> prefix folder, for further packaging. So far so good.
>
> We are also using several thirdparty libraries, hosting them inside our
> own repository and building them along with our own code, usually using
> add_subdirectory utilizing their native CMake buildsystem.
>
> Turns out, other developers also like the CMake install mechanism.
>
> So now the INSTALL target of our whole project also installs thirdparty
> components, which we do not want to deliver with our own product (think
> static libraries, which are already linked into our executable).
>
> After a lot of googling, here's my question: Is there a clean way to
> disable the install target for a subdirectory _without_ also disabling
> it completely for the remaining project?
>
> What we already tried:
> * Setting CMAKE_INSTALL_PREFIX to a temporary directory for the
> subdirectory (doesn't work)
> * "function(install) endfunction()" to disable the install function for
> the subdirectory (breaks CMake in hilarious ways)
>
> What we now do:
> Using a custom target, we patch the cmake_install.cmake files in the
> build directories before installing (works, but it's an  abomination of
> a hack)
>
> Any help? I think it's a valid usecase for CMake but there doesn't seem
> to be an easy way to do it.
>
> We are using CMake 3.5.
>
>
> Thank you :)
>
> --
>   Milan
>   mi...@fastmail.com
> --
>
> 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
-- 

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] Disabling INSTALL target for subdirectory

2017-02-16 Thread Domen Vrankar
2017-02-16 7:59 GMT+01:00 Milan Ziegler :

> Hi,
>
> we are using the CMake install mechanism "install(...)" to copy all
> relevant files and target binaries of the product into the CMake install
> prefix folder, for further packaging. So far so good.
>
> We are also using several thirdparty libraries, hosting them inside our
> own repository and building them along with our own code, usually using
> add_subdirectory utilizing their native CMake buildsystem.
>
> Turns out, other developers also like the CMake install mechanism.
>
> So now the INSTALL target of our whole project also installs thirdparty
> components, which we do not want to deliver with our own product (think
> static libraries, which are already linked into our executable).
>
> After a lot of googling, here's my question: Is there a clean way to
> disable the install target for a subdirectory _without_ also disabling
> it completely for the remaining project?
>

I would never add third party libraries to my own project in such a way
mainly because:
- either my project or external project may change a variable (cache it)
and give me a head ache figuring out where the interaction went wrong (and
having to be so intimate with their build scripts is usually poor use of
time) and
- I would rarely/somewhat independently be changing their code.

I would either build external libraries (of course along with the relevant
headers) and install them somewhere on the system (treating them as a
separate project development wise) and then write find scripts for my
project to be used with "find_package()" command
or in case I'll be making some sort of an uberbuild or changing the
external code a bit more regularly (at which point I'd start to question
the design and maturity of the external dependency...) I'd go with
ExternalProject_Add() command and then install the dependencies that I'd
still like to see in my project by calling combination of
"ExternalProject_Get_Property(... binary_dir)" and "install()" commands -
external projects won't rebuild automatically if you change the code but
you can always go into the relevant subdirectory and rebuild it there (I've
found no problems doing that as usually I won't go changing multiple
external dependencies at the same time - doing that would usually indicate
poor design or invalid use of the external dependencies or my code).

Regards,
Domen
-- 

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] Disabling INSTALL target for subdirectory

2017-02-15 Thread Craig Scott
You can use the COMPONENT option to install() for your own project and then
select a component-based package if you are packaging with CPack. We
currently do this with builds that incorporate other projects with
add_subdirectory() similar to your case.

If you are using install as a build target (ie make install or equivalent),
I don't think the above will help you. I don't recall if the
EXCLUDE_FROM_ALL option to add_subdirectory() affects install or not. I
believe there was some discussion about this in one of the mailing lists or
gitlab issues recently, so maybe someone else can chime in to clarify this
part.


On Thu, 16 Feb 2017 at 3:59 pm, Milan Ziegler  wrote:

> Hi,
>
> we are using the CMake install mechanism "install(...)" to copy all
> relevant files and target binaries of the product into the CMake install
> prefix folder, for further packaging. So far so good.
>
> We are also using several thirdparty libraries, hosting them inside our
> own repository and building them along with our own code, usually using
> add_subdirectory utilizing their native CMake buildsystem.
>
> Turns out, other developers also like the CMake install mechanism.
>
> So now the INSTALL target of our whole project also installs thirdparty
> components, which we do not want to deliver with our own product (think
> static libraries, which are already linked into our executable).
>
> After a lot of googling, here's my question: Is there a clean way to
> disable the install target for a subdirectory _without_ also disabling
> it completely for the remaining project?
>
> What we already tried:
> * Setting CMAKE_INSTALL_PREFIX to a temporary directory for the
> subdirectory (doesn't work)
> * "function(install) endfunction()" to disable the install function for
> the subdirectory (breaks CMake in hilarious ways)
>
> What we now do:
> Using a custom target, we patch the cmake_install.cmake files in the
> build directories before installing (works, but it's an  abomination of
> a hack)
>
> Any help? I think it's a valid usecase for CMake but there doesn't seem
> to be an easy way to do it.
>
> We are using CMake 3.5.
>
>
> Thank you :)
>
> --
>   Milan
>   mi...@fastmail.com
> --
>
> 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

-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

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] Disabling INSTALL target for subdirectory

2017-02-15 Thread Konstantin Podsvirov
Hello all!10:00, 16 February 2017 г., Milan Ziegler :Hi,we are using the CMake install mechanism "install(...)" to copy allrelevant files and target binaries of the product into the CMake installprefix folder, for further packaging. So far so good.We are also using several thirdparty libraries, hosting them inside ourown repository and building them along with our own code, usually usingadd_subdirectory utilizing their native CMake buildsystem.Turns out, other developers also like the CMake install mechanism.So now the INSTALL target of our whole project also installs thirdpartycomponents, which we do not want to deliver with our own product (thinkstatic libraries, which are already linked into our executable).After a lot of googling, here's my question: Is there a clean way todisable the install target for a subdirectory _without_ also disablingit completely for the remaining project?What we already tried:* Setting CMAKE_INSTALL_PREFIX to a temporary directory for thesubdirectory (doesn't work)* "function(install) endfunction()" to disable the install function forthe subdirectory (breaks CMake in hilarious ways)What we now do:Using a custom target, we patch the cmake_install.cmake files in thebuild directories before installing (works, but it's an  abomination ofa hack)Any help? I think it's a valid usecase for CMake but there doesn't seemto be an easy way to do it.We are using CMake 3.5.Thank you :)--   Milan  mi...@fastmail.com-- Powered by www.kitware.comPlease keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQKitware offers various services to support the CMake community. For more information on each offering, please visit:CMake Support: http://cmake.org/cmake/help/support.htmlCMake Consulting: http://cmake.org/cmake/help/consulting.htmlCMake Training Courses: http://cmake.org/cmake/help/training.htmlVisit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.htmlFollow this link to subscribe/unsubscribe:http://public.kitware.com/mailman/listinfo/cmakeIt common actual problem.My suggestion:a) Separate CMakeLists.txt code to several files: - CMakeLists.txt; - CTestLists.txt; - CDashLists.txt; - CPackLists.txt;b) Add common options to enable/disable feature for directory: - CMAKE_LISTS_TXT:BOOL; - CTEST_LISTS_TXT:BOOL; - CDASH_LISTS_TXT:BOOL; - CPACK_LISTS_TXT:BOOL;c) Fix add_subdirectory command implementation :-)--Regards,Konstantin Podsvirov
-- 

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] Disabling INSTALL target for subdirectory

2017-02-15 Thread Milan Ziegler
Hi,

we are using the CMake install mechanism "install(...)" to copy all
relevant files and target binaries of the product into the CMake install
prefix folder, for further packaging. So far so good.

We are also using several thirdparty libraries, hosting them inside our
own repository and building them along with our own code, usually using
add_subdirectory utilizing their native CMake buildsystem.

Turns out, other developers also like the CMake install mechanism.

So now the INSTALL target of our whole project also installs thirdparty
components, which we do not want to deliver with our own product (think
static libraries, which are already linked into our executable).

After a lot of googling, here's my question: Is there a clean way to
disable the install target for a subdirectory _without_ also disabling
it completely for the remaining project?

What we already tried:
* Setting CMAKE_INSTALL_PREFIX to a temporary directory for the
subdirectory (doesn't work)
* "function(install) endfunction()" to disable the install function for
the subdirectory (breaks CMake in hilarious ways)

What we now do:
Using a custom target, we patch the cmake_install.cmake files in the
build directories before installing (works, but it's an  abomination of
a hack)

Any help? I think it's a valid usecase for CMake but there doesn't seem
to be an easy way to do it.

We are using CMake 3.5.


Thank you :)

--
  Milan
  mi...@fastmail.com
-- 

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