[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] using find_library with a ExternalProject
From: Ian Monroe <ian () monroe ! nu>
Date: 2012-10-22 16:34:19
Message-ID: CAHh0A5UKN5q=vW7B8Az0Gdj9zCepR8-GNhr3Dz3VSs-95Wq0ow () mail ! gmail ! com
[Download RAW message or body]
On Mon, Oct 22, 2012 at 6:07 AM, Bill Hoffman <bill.hoffman@kitware.com> wrote:
> On 10/21/2012 10:20 PM, Ian Monroe wrote:
>>
>> So I had code like:
>> include(ExternalProject)
>> ExternalProject_Add(
>> mockcpp
>> DOWNLOAD_COMMAND hg clonessh://hg@bitbucket.org/godsme/mockcpp
>>
>> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MOCKCPP_PREFIX}
>> UPDATE_COMMAND hg pull
>> )
>>
>> find_library(MOCKCPP_LIBRARY
>> NAMES
>> mockcpp
>> PATHS
>> ${MOCKCPP_PREFIX}/lib
>> NO_DEFAULT_PATH)
>>
>> This worked just fine until I used it on a fresh build. Then cmake
>> wouldn't finish since at cmake-time the library doesn't exist.
>
>
> This is a limitation of External project, you can not mix external project
> with non-external project CMake code and have it work in a portable manner.
> Since external project defers download, configure and build until build
> time, there is nothing for the find_library to find at configure time
> because the code is not even there in many cases.
>
> The way to do it is to change the rest of the project into external
> projects:
> ExternalProject_Add(mockcpp)
> ExternalProject_Add(MyProject)
>
> Inside MyProject, you call find_library because mockcpp will be downloaded,
> configured, and built by then.
So what was the target use-case for ExternalProject? From the name it
sounds like it was meant exactly for making your non-external project
(aka your project) be able to pull in dependencies from external
projects.
To make the project itself an external project gives up a lot of
flexibility in cmake configuration. And would just plan mess up my
source tree. :)
Ian
--
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic