[CMake] adding external project

Owen Hogarth II gurenchan at gmail.com
Tue Dec 15 05:57:16 EST 2015


oh, that was it a typo!

A few more questions. I build the project like this:
ExternalProject_Add(sdl
    HG_REPOSITORY http://hg.libsdl.org/SDL
    UPDATE_COMMAND ""

    CMAKE_ARGS -DSDL_STATIC:BOOL=FALSE
    -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/lib

    SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL

    INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin
    )

That seems to build everything and put everything in the right place.
Another thing that I did with other parts of my code was add these lines to
the end of the cmakelists.txt files

TARGET_INCLUDE_DIRECTORIES(mylib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/headers)

so that I can just #include "mylib" instead of the path to the file. With
this setup, I can't do target_include_directories from the
external_project_add command, how do I get those headers?

On Tue, Dec 15, 2015 at 6:26 PM, Nicholas Braden <nicholas11braden at gmail.com
> wrote:

> What's the word "clone" doing in there? That should be a URL, not
> command parameters.
>
> On Tue, Dec 15, 2015 at 2:01 AM, Owen Hogarth II <gurenchan at gmail.com>
> wrote:
> > I have been reading this:
> > https://cmake.org/cmake/help/v3.0/module/ExternalProject.html
> >
> > trying to add sdl external project but I am  having issues. I created a
> new
> > cmake project to test.
> >
> > I already downloaded the sdl library and can build it correctly by
> manually
> > calling cmake commands but this is how I'd like to distribute sdl w/ my
> > library.
> >
> > here's my new test cmake:
> >
> > cmake_minimum_required(VERSION2.8)
> > project(sdl_external)
> >
> > include(ExternalProject)
> >
> > ExternalProject_Add(sdl
> >     HG_REPOSITORY clone http://hg.libsdl.org/SDL
> >     # PREFIX ${CMAKE_SOURCE_DIR}/sdl
> >
> >     # SOURCE_DIR ${CMAKE_SOURCE_DIR}/sdl
> >
> >     # INSTALL_COMMAND cmake ../ PREFIX=${CMAKE_CURRENT_BINARY_DIR}
> >     )
> >
> > I get this build output:
> > cmake ../
> > -- The C compiler identification is GNU 4.9.2
> > -- The CXX compiler identification is GNU 4.9.2
> > -- Check for working C compiler: /usr/bin/cc
> > -- Check for working C compiler: /usr/bin/cc -- works
> > -- Detecting C compiler ABI info
> > -- Detecting C compiler ABI info - done
> > -- Check for working CXX compiler: /usr/bin/c++
> > -- Check for working CXX compiler: /usr/bin/c++ -- works
> > -- Detecting CXX compiler ABI info
> > -- Detecting CXX compiler ABI info - done
> > -- Found Hg: /usr/bin/hg (found version "3.1.2")
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to: /home/blubee/sdk/test/build
> > Scanning dependencies of target sdl
> > [ 12%] Creating directories for 'sdl'
> > [ 25%] Performing download step (hg clone) for 'sdl'
> > -- Avoiding repeated hg clone, stamp file is up to date:
> > '/home/blubee/sdk/_b/build/test/
> > build/sdl-prefix/src/sdl-stamp/sdl-hginfo.txt'
> > [ 37%] No patch step for 'sdl'
> > [ 50%] Performing update step (hg pull) for 'sdl'
> > abort: no repository found in '
> > /home/blubee/sdk/test/build/sdl-prefix/src/sdl' (
> > .hg not found)!
> > CMakeFiles/sdl.dir/build.make:89: recipe for target
> > 'sdl-prefix/src/sdl-stamp/sdl-update'
> >  failed
> > make[2]: *** [sdl-prefix/src/sdl-stamp/sdl-update] Error 255
> > CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/sdl.dir/all'
> failed
> > make[1]: *** [CMakeFiles/sdl.dir/all] Error 2
> > Makefile:76: recipe for target 'all' failed
> > make: *** [all] Error 2
> >
> > my external build file isn't very verbose but I don't get the error
> >
> > why is it reporting that no repository found.
> > abort: no repository found in
> > '/home/blubee/sdk/test/build/sdl-prefix/src/sdl' (
> > .hg not found)!
> >
> > Why isn't the mercurial project not being downloaded?
> >
> > --
> >
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151215/f5c4c0bc/attachment-0001.html>


More information about the CMake mailing list