Let me start by saying I consider my self a cmake newbie. I've made simple
makefiles and simple cmake files, but anything more complicated has to this
point eluded me. Not for a lack of trying, searching, researching, trail, and a
great deal of error: I simply have not been able to achieve the things I'm
after. If the sort of questions I'm asking have been answered elsewhere (as I'm
sure they have), I apologize for asking them again. That being said, I realize
I'm going to be asking some questions that my Google-Fu has failed me in
answering. Forgive me my failings, but I'm at my witts end.
I have a project that I'm building on Linux that has a server component and a
client component that also needs to run on Windows. It uses several libraries
that I want to version lock so I run into fewer issues with cross compiling and
feature creep.
The project is laid out like this:
/home
mydir/
project/
build/
bundle/
deps/
curl-7.43.0/
libiconv-1.14/
libpng-1.6.18/
libssh2-1.6.0/
openssl-1.0.2d/
sqlite/
tinycthread/
zlib-1.2.8/
include/
client/
client.h
common/
config.h
common_funcs.h
server/
server.h
src/
client/
client.c
common/
common_funcs.c
server/
server.c
curl, libiconv, libpng, libssh2, and zlib are the libs I want to build and use
both on Linux and Windows. I know all of those are available on Linux and I
could use the system installed versions, but I want to use the same vesions on
Windows as well. The server is only built on Linux, while the client needs to
be built for Linux and Windows. All the libs, headers, etc go into the build
directory, and the final "make install" puts everything into the bundle
directory, so it can be packaged for distribution.
The client needs the curl, libiconv, libpng, libssh2, openssl, and zlib
libraries. tinycthread is compiled directly into the client, so that's not an
issue.
The server needs the curl, libiconv, libssh2, openssl, and zlib libraries.
tinycthread and sqlie are compiled directly into the server, so that's not an
issue.
Ideally, I'd like my cmake file to build the deps that need to be built, build
the server and client for Linux, and finally build the client for Windows. Yes,
all from the same cmake file. I realize this will probably have to be done with
multiple cmake files or a bash script, but that's ok.
I think building the libs can be done with custom commands or targets, but I
haven't been able to figure out how. I haven't been able to get cmake to use
only my versions of the libs I've compiled. Some of the libs are being found
from the system wide versions, some are coming from my directory.
My main problem is getting cmake to use only my locally installed/compiled
copies of the libs. I need those libs to live along side the binaries, and
using the versions I compile is important.
Rather than provide the CMakeLists.txt I've been using, I'd like it if someone
could provide an example file that would compile the above libraries (all of
which use autoconf or custom compile scripts) and the client and server for
Linux and Windows. I'm 100% certain I am not doing things correctly when it
comes to the layout of the CMakeLists.txt, so I'd like to see something fresh
from someone with much more experience in build script creation.
Any help is greatly appreciated.
[email protected]
--
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