[CMake] Adding a reference to a .NET dll in my C++/CLI project

Aaron Ten Clay aaron at madebyai.com
Wed Jan 4 20:03:24 EST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/04/12 14:32, brian wrote:
> I've been able to generate VS 2010 solution's via CMake for my C++/CLI
project (.NET project). We've added the log4net.dll to the project by
hand. This is the .NET version of the log4j project. What I'd like to do
is add a reference to this DLL to the solution via cmake using a
Findlog4net.cmake file with a given version number but haven't figured
out how to integrate this since its a dll only.
>
> I've tried,
> find_library(LOG4NET_LIB log4net ${PATH_TO_DLL_LOCATION})
>
> but this hasn't worked.
>
> Any ideas?
>
> Brian
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
I recently submitted a patch for CMake to allow linking against .NET
DLLs. The code to support this should be in 2.8.7. The way to accomplish
the .NET linking is:

set_target_properties(your_target VS_DOTNET_REFERENCES
"System;Log4Net.Logger")

or whatever the necessary namespaces are. You will of course need the
relevant DLLs in the system search path at build and run time.

Hope that helps.

- -Aaron



- -- 
Aaron Ten Clay
MadeByAI Consulting
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8E9tsACgkQXXAPYyclsaWHLgCffvl0ffA7hnl3yCC1y9JXPWRx
7P8AnAmC4jYSGOzkiNMiMl/onsBrNLB6
=KRmB
-----END PGP SIGNATURE-----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120104/8f789146/attachment.htm>


More information about the CMake mailing list