[CMake] External dependencies and Windows

Luigi Calori l.calori at cineca.it
Mon Feb 4 11:03:11 EST 2013


I think your question make sense, I would be interested to know proposed 
solutions, as likely have similar problems.

I' m far from being a cmake guru, but I like SuperBuild pattern as well .
I would do these steps:

0) define where are on the different platform the sources of the SDL 
library   you want  ( is it http://www.libsdl.org/download-1.2.php ?)
      also you should think  if is likely to find it already installed 
and you want to let your users to use it
1) test the currently available FindSDL.cmake with latest cmake release 
with find_package(SDL) and see if it is working on all target    platforms.
     If it is not suitable, build one which fits your need.
2) build your simple project hello world by using find_package(SDL), 
eventually using your own FindSDL.cmake
3) build one hello_world_SDL_superbuild project which
         find_package(SDL)
         if(NOT SDL_FOUND)
             add_external_project(SDL
                    ..............
                    ..............
             )
         )
            add_external_project(HELLO_WORLD_SDL
               .................
               .................
              DEPENDS SDL
            )

If the SDL external project has an INSTALL_PREFIX path that is reported 
inside as CMAKE_PREFIX_PATH, the find should work in both situations

when everything works fine, it is likely that your SDL external project 
as well as your Find_SDL.cmake could be of interest to others ;-)



If the cmake gurus agree that this form of SuperBuild pattern is the 
right one, it could be good  to develop it as an example, with proper 
FindSDL.cmake






On 04/02/2013 15.14, Ansis Ma-lin,s( wrote:
> It looks like I'm still asking the wrong questions.
>
> As a last resort, here's my specific problem: I want to compile and 
> run a hello world SDL2 application on Windows, Linux, and OS X - 
> purely as an exercise in CMake. How would YOU do this?
>
> SDL2 only exists in source form in their repository.
>
> This is my main.cpp:
> #include <SDL.h>
> int main(int argc, char** argv)
> {
> if (SDL_Init(SDL_INIT_VIDEO) < 0) printf("FAILURE\n");
> else printf("SUCCESS\n");
> SDL_Quit();
> return 0;
> }
>
>
> --
>
> 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


-- 
Luigi Calori
SuperComputing Applications and Innovation Department
CINECA - via Magnanelli, 6/3, 40033 Casalecchio di Reno (Bologna) - ITALY
Tel: +39 051 6171509  Fax: +39 051 6132198
hpc.cineca.it

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130204/b4e27f10/attachment-0001.htm>


More information about the CMake mailing list