[CMake] ExternalProject, target_link_libraries(), and Multi-configuration Builds.
michael lowell roberts
zoarre at gmail.com
Sat Oct 8 20:09:14 EDT 2011
On Sat, Oct 8, 2011 at 6:40 AM, Michael Hertling <mhertling at online.de>wrote:
> On 10/08/2011 05:33 AM, michael lowell roberts wrote:
> > Hi all,
> >
> > I'm attempting to use the ExternalProject module to compile and link
> against
> > a library and I've run into a problem that I'm not certain how to
> address.
> > I'm using CMake 2.8.6 and Visual Studio 10 Express.
> >
> > The external project, in my case, is a CMake-compiled project and CMake
> > predictably builds a matching configuration in the external project.
> >
> > The target_link_libraries() command, however, only allows for two
> > configurations, at most, mapped to labels "debug" and "optimized."
> >
> > This allows for only two of the four default build configurations to
> > complete successfully.
> >
> > For example, in my build scripts, I have told target_link_libraries() to
> map
> > "debug" configurations to the Debug version of library and optimized
> > configurations map to the "RelWithDebInfo" build of the library.
> Therefore,
> > if I build the "Release" configuration, I get linker errors because the
> > external project was also built with the "Release" configuration but I
> need
> > to link against "RelWithDebInfo."
> >
> > It seems to be that no matter how the target_link_library() mappings are
> set
> > up, only half of the default configurations will build properly because
> of
> > the dualism that target_link_libraries() uses.
> >
> > How do I get all four default build configurations working?
> >
> > Regards,
> > Mike
>
> Could you boil down this issue to a minimal but self-contained
> exemplary project and post it here for further investigation?
>
Certainly.
I've attached a sample project that downloads and compiles the trio library,
which can be found at the following site:
http://daniel.haxx.se/projects/trio/
It then attempts to link the library into a trivial executable that simply
prints a message to the screen.
The build exhibits the problem I mentioned. Debug builds complete
successfully. Release builds do not.
Additionally, the IDE appears incapable of determining when the build is
up-to-date. Try to debug the executable to reproduce this problem. I'm
inclined to believe that this is due to something I've done wrong and any
help with this problem would also be appreciated.
Lastly, I'm certain that there are other problems I have not identified yet.
If you could point out anything else that is obviously problematic, I would
be grateful. Perhaps I am over-complicating the code, for example.
Thanks,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111008/49258a96/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: externalproj_eg.zip
Type: application/zip
Size: 6962 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111008/49258a96/attachment.zip>
More information about the CMake
mailing list