<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 17/10/2011 18.27, Milutin Jovanović wrote:
<blockquote
cite="mid:CANsc6G5dxAN-UTmqm+up+1RmB+eVwBHR5o=rM7h4k+MUSkosLA@mail.gmail.com"
type="cite"><br>
Hi all,<br>
<br>
Hi all. First time posting. Before I start I'd like to thank all
the Kitware guys for a very nice and useful tool. I did a fair bit
of searching to try to avoid asking duplicate questions, but did
not find answer to my problem.<br>
<br>
I am trying to make a private build of some dependencies, ogg and
vorbis in this case. The initial problem is that second library
make is not finding first, due to pkg-config not finding output
files from the first library. OK, I said, and did
PKG_CONFIG_PATH=... and export PKG_CONFIG_PATH before executing
cmake build. And this fixed the problem.<br>
<br>
However then I tried to ease the job of whoever might be using
this, and tried setting the PKG_CONFIG_PATH inside the cmake
script. But this does not work. I did some tests, and indeed,
configure executed as part of ExternalProject does not see
environmental variables set by cmake.<br>
<br>
So, the question is, am I doing something wrong or is this cmake
limitation?<br>
</blockquote>
I' m not really sure, but I think it is a CMake limitation that has
been discussed before:<br>
When you do<br>
<br>
set(ENV{PKG_CONFIG_PATH}
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")<br>
<br>
I think that you are setting the environment for the current cmake
process and all it' s child processes.<br>
<br>
The problem is that when you use ExternalProject_Add() you are
building a Makefile that will be processed at "build" time whwn you
invoke make (or a XCode ide processing)<br>
<br>
That process is NOT a child of your cmake, so the env is lost<br>
<br>
As far as I know, there is (unfortunately) no ENV clause in
ExternalProcess, so the only (ugly) workaround that I have found is
to define a wrapper of the two configure and make processes that
pass the env you need like:<br>
<br>
1) using the included pkgconfig_env.cmake<br>
2) calling the wrapper script as I' ve tried to show subsequently by
modifying your second call<br>
<br>
There could be a simpler way in your case, but I' ve included this
as is what I' m using for packaging external libraries.<br>
<br>
I would really like to have an ENV clause in ExternalProcess to
force all the called steps to have a defined environment<br>
<br>
HTH<br>
Luigi<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<blockquote
cite="mid:CANsc6G5dxAN-UTmqm+up+1RmB+eVwBHR5o=rM7h4k+MUSkosLA@mail.gmail.com"
type="cite"><br>
Miki.<br>
<br>
P.S. I am doing this on a Mac OSX Lion, but I expect it to work on
Linux without modifications.<br>
<br>
=== CMakeLists.txt ===<br>
<br>
cmake_minimum_required(VERSION 2.8) <br>
<br>
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Path
where to install.")<br>
<br>
project(dependecies)<br>
<br>
include(ExternalProject)<br>
<br>
set(ENV{PKG_CONFIG_PATH}
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")<br>
message(STATUS "PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}")<br>
<br>
ExternalProject_Add(<br>
libogg<br>
PREFIX libogg<br>
URL <a moz-do-not-send="true"
href="http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz">http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz</a><br>
URL_MD5 0a7eb40b86ac050db3a789ab65fe21c2<br>
UPDATE_COMMAND set<br>
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX}<br>
BUILD_COMMAND make<br>
# INSTALL_COMMAND make install<br>
BUILD_IN_SOURCE 1<br>
)<br>
<br>
</blockquote>
set(_mymoduledir <---- where you put the included file
pkgconfig_env.cmake ------><br>
set(conf_command_body ./configure --prefix=${CMAKE_INSTALL_PREFIX}
--with-ogg=${CMAKE_INSTALL_PREFIX}<br>
string(REPLACE ";" "@@" managed_conf_command_body
"${conf_command_body}" )<br>
set(conf_command CONFIGURE_COMMAND ${CMAKE_COMMAND}
-Dmy_binary_dir:PATH=<BINARY_DIR>
-Dmy_source_dir:PATH=<SOURCE_DIR>
-Dmy_install_dir:PATH=${CMAKE_INSTALL_PREFIX}
-Dmy_configure:STRING=${managed_conf_command_body} -P
${_mymoduledir}/pkgconfig_env.cmake) <br>
<br>
set(make_command_body make --jobs 4)<br>
string(REPLACE ";" "@@" managed_make_command_body
"${make_command_body}" )<br>
set(make_command BUILD_COMMAND ${CMAKE_COMMAND}
-Dmy_binary_dir:PATH=<BINARY_DIR>
-Dmy_source_dir:PATH=<SOURCE_DIR>
-Dmy_install_dir:PATH=${CMAKE_INSTALL_PREFIX}
-Dmy_configure:STRING=${managed_make_command_body} -P
${_mymoduledir}/pkgconfig_env.cmake) <br>
set(list_separator "LIST_SEPARATOR @@")<br>
<br>
<blockquote
cite="mid:CANsc6G5dxAN-UTmqm+up+1RmB+eVwBHR5o=rM7h4k+MUSkosLA@mail.gmail.com"
type="cite">ExternalProject_Add(<br>
libvorbis<br>
DEPENDS libogg<br>
PREFIX libvorbis<br>
URL <a moz-do-not-send="true"
href="http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2">http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2</a>
<br>
URL_MD5 798a4211221073c1409f26eac4567e8b<br>
UPDATE_COMMAND set<br>
</blockquote>
${conf_command}<br>
${make_command}<br>
${list_separator}<br>
<blockquote
cite="mid:CANsc6G5dxAN-UTmqm+up+1RmB+eVwBHR5o=rM7h4k+MUSkosLA@mail.gmail.com"
type="cite"><br>
# INSTALL_COMMAND make install<br>
BUILD_IN_SOURCE 1<br>
)<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
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
</pre>
</body>
</html>