[rabbitmq-discuss] building SimpleAmqpClient

Alan Antonuk alan.antonuk at gmail.com
Sat Mar 3 05:49:18 GMT 2012


I think you're misunderstanding how to use cmake: when I said set a
variable I meant a cmake variable and not a shell variable.

You set a cmake variable by adding a -DVARIABLE_NAME=VALUE to the command
line.

To be more concrete, lets say you have your rabbitmq-c source tree in:
c:\dev\rabbitmq-c
And have built the project in-source using MSVC

You have boost v1.47.0 in, and its built with shared libraries
c:\dev\boost-1.47.0

The appropriate cmake command might look something like:
$ cmake -DBOOST_ROOT=c:\dev\boost-1.47.0
-DBoost_ADDITIONAL_VERSIONS="1.47.0"
-DRabbitmqc_INCLUDE_DIR=c:\dev\rabbitmq-c\librabbitmq
-DRabbitmqc_LIBRARY=c:\dev\rabbitmq-c\librabbitmq\Debug\rabbitmq.lib

You can also use the cmake-gui program to set these variables.

That said: the FindRabbitmq.cmake module does not expect to find the
headers and the libraries in a source, or build tree.  It expects to find
these in an 'install tree', which basically copies the correct files to a
known location and structure: headers in ${PREFIX}/include libraries in
${PREFIX}/lib and executables in ${PREFIX}/bin. On linux/unix ${PREFIX} is
usually /usr/local, on windows its in C:\Program Files\${ProjectName} -
which I personally don't like.

My recommendation would be to run cmake-gui in your rabbitmq-c build and
set the CMAKE_INSTALL_PREFIX to something like c:\dev\install, then build
the 'INSTALL' project which will copy the appropriate files to an install
tree in c:\dev\install

You can then either add c:\dev\install\include and c:\dev\install\lib paths
to the INCLUDE and LIB environment variables or you can set the cmake
variable Rabbitmqc_DIR to c:\dev\install when running cmake against
SimpleAmqpClient, and save having to specify the Rabbitmqc_INCLUDE_DIR and
Rabbitmqc_LIBRARY individually.

Note that since rabbitmq is built as a shared library (DLL on windows) by
default, you'll need to have the rabbitmq.dll in a place that windows can
find it (putting these in the same directory as the executable or adding
the path containing the DLL to the PATH environment variable.

HTH
-Alan

On Fri, Mar 2, 2012 at 7:55 AM, Eric J. Holtman <eric at holtmans.com> wrote:

> On 3/1/2012 10:59 PM, Alan Antonuk wrote:
>
> >
> > *For finding Rabbitmq-c* I wrote a FindRabbitmqc.cmake (in the Modules
> > directory).
> >
> > It searches for the amqp.h file in:
> > ${Rabbitmqc_DIR}/include
> > Then your system paths
> >
> > If it doesn't pick it up automatically you set Rabbitmqc_INCLUDE_DIR to
> the
> > directory containing the amqp.h file by hand.
> >
> > It searches for the rabbitmq library (librabbitmq.a/librabbitmq.so on
> *nix
> > rabbitmq.lib/.dll on windows) in:
> > ${Rabbitmq_DIR}/lib
> > Then your system include paths
> >
> > If it doesn't pick it up automatically, you can set Rabbitmqc_LIBRARY to
> > the filename of the library by hand.
> >
> > Hope that helps.
> >
>
>
> I tried that:
>
> C:\rabbit-c\simpleamqpclient-build>dir %Rabbitmqc_INCLUDE_DIR%\amqp.h
>  Volume in drive C has no label.
>  Volume Serial Number is 60C2-C1FC
>
>  Directory of c:\rabbit-c\rabbitmq-c\librabbitmq
>
> 02/15/2012  03:00 PM            14,097 amqp.h
>               1 File(s)         14,097 bytes
>               0 Dir(s)  36,886,913,024 bytes free
>
> so, amqp.h is in the right place.
>
> C:\rabbit-c\simpleamqpclient-build>dir %Rabbitmqc_LIBRARY%\rabbitmq.*
>  Volume in drive C has no label.
>  Volume Serial Number is 60C2-C1FC
>
>  Directory of c:\rabbit-c\rabbitmq-c-build\librabbitmq\Debug
>
> 02/22/2012  01:15 PM           108,544 rabbitmq.dll
> 02/15/2012  05:03 PM             9,383 rabbitmq.exp
> 02/22/2012  01:15 PM           265,216 rabbitmq.idb
> 02/22/2012  01:15 PM           386,320 rabbitmq.ilk
> 02/15/2012  05:03 PM            16,132 rabbitmq.lib
> 02/22/2012  01:15 PM           815,104 rabbitmq.pdb
>               6 File(s)      1,600,699 bytes
>               0 Dir(s)  36,886,913,024 bytes free
>
> .dll/.lib in the right place:
>
>
> C:\rabbit-c\simpleamqpclient-build>cmake ..\SimpleAmqpClient
> -- Building for: Visual Studio 9 2008
> -- Check for working C compiler using: Visual Studio 9 2008
> -- Check for working C compiler using: Visual Studio 9 2008 -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler using: Visual Studio 9 2008
> -- Check for working CXX compiler using: Visual Studio 9 2008 -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Boost version: 1.47.0
> -- Found the following Boost libraries:
> --   chrono
> --   system
> Rabbitmqc_INCLUDE_DIR=Rabbitmqc_INCLUDE_DIR-NOTFOUND
> Rabbitmqc_LIBRARY=Rabbitmqc_LIBRARY-NOTFOUND
> CMake Error at Modules/LibFindMacros.cmake:74 (message):
>  Required library Rabbitmqc NOT FOUND.
>
>  Install the library (dev version) and try again.  If the library is
> already
>  installed, use ccmake to set the missing variables manually.
> Call Stack (most recent call first):
>  Modules/FindRabbitmqc.cmake:19 (LIBFIND_PROCESS)
>  CMakeLists.txt:12 (FIND_PACKAGE)
>
>
> -- Configuring incomplete, errors occurred!
>
>
>
>
>
>
> Still fails.
>
> I'm wondering if this is even worth the effort.  (Not your wrapper,
> just the cmake process).
>
> Once I've gotten the C library itself to build (using python et al
> to build the framing files), I'm tempted to just extract the .c and
> .h files I need into a new Visual Studio project, and go from there.
>
> I understand the concept of cmake (trying to get a platform independent
> delivery base), but at this point, for a library with only really
> 10 .c and .h files, I've got at least 4 directories, the .vcproj files
> have tons of -I directives, and......
>
>
> Anyway, after seeing the trace above, if you have any clues, I'd
> appreciate it.
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120303/92384dfc/attachment.htm>


More information about the rabbitmq-discuss mailing list