On 30/01/16 09:42 PM, vadtec wrote: > 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. ... > Any help is greatly appreciated. > > ------------------------------------------------------------------------ > Vadtec > vad...@vadtec.net > > Check out how it's done with FLTK at fltk.org.
We put each dependency in its own folder with its own CMakeLists.txt then do an add_subdirectory for each. The add_subdirectory calls are dependent on whether that particular library is available as a system library and if so which you want to build with.
I'm sure you could adapt this to your purpose. Mike -- 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