On 10/21/2012 10:20 PM, Ian Monroe wrote:
So I had code like:
include(ExternalProject)
ExternalProject_Add(
mockcpp
DOWNLOAD_COMMAND hg clonessh://[email protected]/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.
-Bill
--
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
[email protected]
http://www.kitware.com
518 881-4905 (Direct)
518 371-3971 x105
Fax (518) 371-4573
--
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