On 24/03/2015 18:31, David Cole wrote:
Hi David,
How about:

     add_custom_target(custom-install DEPENDS xxx-install)

and

     cmake --build . --target custom-install

??
OK that does work but I wanted the project to have a normal set of targets. The issue is that the ExternalProject in question is the actual purpose of the outer project but the outer project has some special targets that do extra stuff. For example it has a 'source' target that transforms the whole lot into a source tarball suitable for running on an isolated build machine like those used for building Linux packages. The same outer project CMakeLists.txt doubles as the CMakeLists.txt for that source package and build servers expect the "usual" targets to build the package contents.

I don't want to dump the whole of the real project CMakeLists.txt into this superbuild script and that is a maintenance hazard due to the duplication.

The other ExternalProjects that build required components rather neatly fetch from their respective repos unless the source tar ball is there already so they "just work" in this dual phase build process.

The problem is that you are adding a custom target with the name
"install" which is one that CMake generates for you. (Names to be
avoided are all, clean, install, package, help ... (maybe a few
others?))
I understand that but it works without complaint before recent CMake versions.

I think this whole process should be unnecessary anyway, because the
install step of the ExternalProject runs as part of the overall build,
even with just a "cmake --build ." -- doesn't it?
Maybe, but I need to have the 'install' target run when I am running the custom 'source' target of the outer project.

To get this all to hang together I had to set the EXCLUDE_FROM_ALL property to '1' of the ExternalProject in question so it doesn't install when running the default target. This is necessary because we don't want the install phase to run when running our custom targets as CMAKE_INSTALL_PREFIX is set to the outer project CMAKE_INSTALL_PREFIX i.e. we only want this ExternalProject to install when we run the outer 'install' target.

Sorry this is a bit complex and I may not have been clear enough. The basic idea works beautifully with a relatively simple low maintenance superbuild project that wraps a cross platform project that cannot make a kit suitable for Linux packaging and cannot have conventional ExternalProjects for the prerequisites on Windows and Mac. All was well until CMake started complaining about something that works.


HTH,
David C.
Regards
Bill Somerville.

On Tue, Mar 24, 2015 at 2:21 PM, Bill Somerville <[email protected]> wrote:
On 13/03/2015 14:06, Bill Somerville wrote:
Hi All,

I have a superbuild style project consisting of a few external projects. I
wish to build the install target of one of them as part of the install
target of the parent project. I had it working by adding a step target
called install and adding a custom target to the parent project that depends
on the child step target. E.g.

ExternalProject_Add (xxx
   SVN_REPOSITORY ${xxx_repo}
   CMAKE_ARGS
     -D CMAKE_INSTALL_PATH=<INSTALL_DIR>
   INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
   STEP_TARGETS install)

add_custom_target (install DEPENDS xxx-install)

This arrangement allowed me to 'cmake --build . --target install' and have
the child project install target run.

Now CMake complains about policy CMP0037, because I cannot define a
reserved target name, so it seems I cannot abuse the 'install' target by
adding extra dependencies any more.

Is there a better way to link child and parent targets that doesn't invoke
this error?
No replies on this one. Am I asking something that can't be done or am I
missing something obvious?

Regards
Bill Somerville.

--

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

Reply via email to