[CMake] how to specify dependencies out of the source tree?

2011-01-26 Thread Michal Turlik
Hi all
I am trying to build and link against a dependency out of the source tree.
I tried to arrange a custom target/command combo but it did not work.
Could someone help me with this?
What I really need is how to let cmake and make be correclty launched for such 
an out of tree dependency before it would be linked with my application.
thank you so much






  ___
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

Re: [CMake] Improvements for cross-referencing in the documentation?

2011-01-26 Thread SF Markus Elfring

E.g. cmake --help-full.docbook
gives you a docbook file, which can then be processed further.
The interesting thing is how to get the links into these files initially.


Do you need any intermediate format(s) for the desired data exchange?

Regards,
Markus
___
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


Re: [CMake] how to specify dependencies out of the source tree?

2011-01-26 Thread Eric Noulard
2011/1/26 Michal Turlik 
>
> Hi all
> I am trying to build and link against a dependency out of the source tree.
> I tried to arrange a custom target/command combo but it did not work.
> Could someone help me with this?
> What I really need is how to let cmake and make be correclty launched for 
> such an out of tree dependency before it would be linked with my application.
> thank you so much

Did you have a look at ExternalProject_Add from ExternalProject module?

see:
cmake --help-module ExternalProject


--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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


[CMake] Problem with archive_write_finish_entry(): Can't update time...

2011-01-26 Thread Daniel Pfeifer
Hi,

executing the command 'cmake -E tar xfz archive.tgz' can be really
noisy. It works fine in Linux and also in Windows if I use the Qt GUI to
CMake. In a Windows Terminal it reports "CMake Error: Problem with
archive_write_finish_entry(): Can't update time for %s" for every single
file in the archive.

What is the problem here?
I use CMake 2.8.3 on WindowsXP with a FAT32 filesystem.

cheers, Daniel


___
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


Re: [CMake] Problem with archive_write_finish_entry(): Can't update time...

2011-01-26 Thread David Cole
>From the libarchive source code, it looks like this message appears as
a "warning" and returns ARCHIVE_WARN.

CMake spits out an error message whenever a libarchive function
returns anything other than ARCHIVE_OK.

Perhaps we should detect ARCHIVE_WARN and only emit a "CMake Warning"
message rather than a "CMake Error".

As to what could be causing it in the first place... perhaps there's a
permissions problem of some sort? Do you have full write permissions
in the directory where you are extracting? Do the files actually
appear afterwards even though you're seeing these messages? Is it a
"deep" path (long name)?

If you untar the same archive.tgz file with another tar tool, do you
get any warnings or errors from it?


Just some things to try...

David


On Wed, Jan 26, 2011 at 7:15 AM, Daniel Pfeifer  wrote:
> Hi,
>
> executing the command 'cmake -E tar xfz archive.tgz' can be really
> noisy. It works fine in Linux and also in Windows if I use the Qt GUI to
> CMake. In a Windows Terminal it reports "CMake Error: Problem with
> archive_write_finish_entry(): Can't update time for %s" for every single
> file in the archive.
>
> What is the problem here?
> I use CMake 2.8.3 on WindowsXP with a FAT32 filesystem.
>
> cheers, Daniel
>
>
> ___
> 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
>
___
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


Re: [CMake] Find_package: general question

2011-01-26 Thread Michael Hertling
On 01/21/2011 02:59 PM, Vincent Garcia wrote:
> Dear CMake users, 
> 
> I have this BIG project which has tons of subdirectories (many levels). 
> In each (final) subdirectory, I create targets (executables and libraires). 
> So I have my top level CMakeLists.txt and one CMakeLists.txt file (which is 
> also a project) in each subdirectory. 
> Everything compiles just fine! 
> 
> My question is a general CMake question and is the following: 
> Imagine I can use ITK in my project. To do that, in the top level 
> CMakeLists.txt I define a variable USE_ITK. 
> If ITK is used, I search for it and I include useful files: 
> 
> OPTION(USE_ITK "If ON, search for Insight Toolkit package" OFF) 
> IF(USE_ITK) 
> FIND_PACKAGE(ITK) 
> IF(ITK_FOUND) 
> INCLUDE(${ITK_USE_FILE}) 
> ELSE(ITK_FOUND) 
> MESSAGE(FATAL_ERROR "ITK not found. Please set ITK_DIR.") 
> ENDIF(ITK_FOUND) 
> ELSE(USE_ITK) 
> SET(ITK_FOUND OFF) 
> ENDIF(USE_ITK) 
> 
> Now, if one subdirectory's project uses ITK, I have the following code (in 
> the subdir's CMakeLists.txt): 
> 
> FIND_PACKAGE( ITK ) 
> IF( NOT ITK_FOUND ) 
> MESSAGE( "Project ${PROJECT_NAME} requires ITK and ITK was not found. 
> ${PROJECT_NAME} will not be built." ) 
> RETURN() 
> ENDIF() 
> INCLUDE( ${ITK_USE_FILE} ) 
> 
> 
> As you can see, find_package(ITK) and INCLUDE( ${ITK_USE_FILE} ) are at least 
> called twice (in fact much more). 
> Is there any performance issue the method describe above? 

Usually, find modules save their results in CMake's cache to avoid any
repetitive searching for the same executables/libraries/files/... when
invoked multiple times. E.g., the FIND_{PROGRAM,LIBRARY,...}() commands
- which are used heavily in find modules - store their positive results
in cached variables and don't perform their particular search again if
these variables don't evaluate to -NOTFOUND. In general, well written
find modules ensure that it is safe and cheap to call them more than
once, so the performance penalty due to multiple invocations should
be bearable, ideally even negligible.

> Since it's not my code and since i'm a CMake newbee, I'd like to understand 
> if this is normal. 
> I would say that this should be done once in the top level CMakeLists.txt. 
> In the subdirs' CMakeLists, we should use only ITK_FOUND to decide if we 
> build the target or not. 
> Some people of my team agree and some don't. 

For several reasons, I'd join the latter group. ;) Please note that the
following remarks are just my personal opinion, and of course, one can
take up a different position.

Basically, your approach tends to collect information about the needs
of your subprojects/submodules in the top-level CMakeLists.txt which
is in opposition to a good modularization and a tight locality. E.g.,
if one of your subprojects, situated deep in the overall project's
directory tree, needs package XXX, the top-level CMakeLists.txt must
know this fact to enable XXX by FIND_PACKAGE(XXX). As a result, your
top-level CMakeLists.txt must know and enable all prerequisites of
all subprojects which appears quite inconvenient to me, especially
if your subprojects are somewhat selfcontained.

When using multi-component packages, the situation might even become
worse: Suppose you have two subprojects, app1 uses QtGui while app2
uses QtXml. The top-level CMakeLists.txt according to your approach
would look like:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(APPS C CXX)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml)
INCLUDE(${QT_USE_FILE})
ADD_SUBDIRECTORY(app1)
ADD_SUBDIRECTORY(app2)

Now, look at the following app{1,2}/CMakeLists.txt:

# app1/CMakeLists.txt:
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.c
"int main(void){return 0;}\n"
)
ADD_EXECUTABLE(app1 main.c)
TARGET_LINK_LIBRARIES(app1 ${QT_LIBRARIES})

# app2/CMakeLists.txt:
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.c
"int main(void){return 0;}\n"
)
ADD_EXECUTABLE(app2 main.c)
TARGET_LINK_LIBRARIES(app2 ${QT_LIBRARIES})

With this configuration, app{1,2} get linked against Qt{Core,Gui,Xml},
i.e. both will be overlinked. This is a consequence of the joint list
of components in FIND_PACKAGE(Qt4 ...) for both subprojects; in other
words: A consequence of information about those subprojects' needs,
collected in the top-level CMakeLists.txt.

> What is the best way to proceed? 

In each sufficiently selfcontained subproject, one should issue the
FIND_PACKAGE() commands for all of the subprojects' prerequisites in
order to minimize the dependency on any higher-level CMakeLists.txt.
OTOH, if a subproject consists of several tightly connected modules,
e.g., it's possibly not appropriate to do the same for each module.
Instead, one might concentrate FIND_PACKAGE()'s invocations in the
subproject's CMakeLists.txt and let the modules inherit the results
as long as there are no difficulties like the one mentioned above.

Probably, the question of concentrating or distributing FIND_PACKAGE()
calls for prerequisites in ext

[CMake] Out-of-source build and access to data

2011-01-26 Thread Benjamin Kurz
Hello everyone,

Currently I'm using cmake for building my c++/Qt project.
The source directory structure looks like this:
Project
|_ src
|_ include
|_ data


Currently I run cmake from the source directory, having an in-source-build.
Now I want to be able to have a complete seperate build folder.
It compiles fine and it runs ok, unless I need access to a file in the
data folder.
Currently I access files like this: filepath = "./data/file1"
But data is of course not available in the build directory.
So I copied the files during the cmake process, which also works fine.

But when I run the program I get an exception because the file is not found.
I tried a lot of possibilities:
filepath = "../data/file1"
filepath = "data/file1"
filepath = "file1"

but nothing seems to work.

The executable is on the top directory in the build directory.
The filepath is defined and used in a class in ./src directory.

I am not sure how to fix this or which path to use?!

Any advice is appreciated.

Thanks

Benjamin
___
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


Re: [CMake] Out-of-source build and access to data

2011-01-26 Thread David Cole
Send some code for us to look at.

If the cwd is where your exe is, and there's a file at "./data/file1"
then you should certainly be able to open and read that file with that
file name.

Maybe your cwd is not what you think it is.
Maybe your code changes it somewhere between launching and attempting
to open the file.

I don't understand where you're using a
filepath = "./data/file1"
reference? In your source code? In a settings file of some sort?
Certainly not in a CMakeLists.txt file since this is not cmake
syntax...


??

David


On Wed, Jan 26, 2011 at 9:54 AM, Benjamin Kurz
 wrote:
> Hello everyone,
>
> Currently I'm using cmake for building my c++/Qt project.
> The source directory structure looks like this:
> Project
> |_ src
> |_ include
> |_ data
>
>
> Currently I run cmake from the source directory, having an in-source-build.
> Now I want to be able to have a complete seperate build folder.
> It compiles fine and it runs ok, unless I need access to a file in the
> data folder.
> Currently I access files like this: filepath = "./data/file1"
> But data is of course not available in the build directory.
> So I copied the files during the cmake process, which also works fine.
>
> But when I run the program I get an exception because the file is not found.
> I tried a lot of possibilities:
> filepath = "../data/file1"
> filepath = "data/file1"
> filepath = "file1"
>
> but nothing seems to work.
>
> The executable is on the top directory in the build directory.
> The filepath is defined and used in a class in ./src directory.
>
> I am not sure how to fix this or which path to use?!
>
> Any advice is appreciated.
>
> Thanks
>
> Benjamin
> ___
> 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
>
___
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


Re: [CMake] Out-of-source build and access to data

2011-01-26 Thread Benjamin Kurz
ok, sorry, let's make it more real. I cannot disclose much code, but
it's like this:

I have a normal Qt application started out of a main.cpp which is
located in $SOURCE_DIR/src
In another QWidget also located in $SOURCE_DIR/src I call a function
which is also declared in $SOURCE_DIR/src
with something like this:
loadfile("./data/file1");

if I build the application in-source it works fine.
if I build it in a different place, let's say $BUILD_DIR, it does not
work anymore.

The executables in both cases are on the top level of $SOURCE_DIR
(in-source build) or at the top level of $BUILD_DIR (out-of-source build).

I copy the files with cmake with the following:
file(COPY ${PROJECT_SOURCE_DIR}/data DESTINATION ./)
this works fine, the files are copied and are in the same hierarchy as
in the source tree.

Maybe it's not even a full cmake question, if so I am sorry for that.
But somehow I have to tell my code where to find a file when I have an
out-of-source build.

Hope that clearified it a bit, and did not make it less understandable. :)

Thanks so far.

Benjamin

Am 26.01.2011 16:12, schrieb David Cole:
> Send some code for us to look at.
>
> If the cwd is where your exe is, and there's a file at "./data/file1"
> then you should certainly be able to open and read that file with that
> file name.
>
> Maybe your cwd is not what you think it is.
> Maybe your code changes it somewhere between launching and attempting
> to open the file.
>
> I don't understand where you're using a
> filepath = "./data/file1"
> reference? In your source code? In a settings file of some sort?
> Certainly not in a CMakeLists.txt file since this is not cmake
> syntax...
>
>
> ??
>
> David
>
>
> On Wed, Jan 26, 2011 at 9:54 AM, Benjamin Kurz
>  wrote:
>   
>> Hello everyone,
>>
>> Currently I'm using cmake for building my c++/Qt project.
>> The source directory structure looks like this:
>> Project
>> |_ src
>> |_ include
>> |_ data
>>
>>
>> Currently I run cmake from the source directory, having an in-source-build.
>> Now I want to be able to have a complete seperate build folder.
>> It compiles fine and it runs ok, unless I need access to a file in the
>> data folder.
>> Currently I access files like this: filepath = "./data/file1"
>> But data is of course not available in the build directory.
>> So I copied the files during the cmake process, which also works fine.
>>
>> But when I run the program I get an exception because the file is not found.
>> I tried a lot of possibilities:
>> filepath = "../data/file1"
>> filepath = "data/file1"
>> filepath = "file1"
>>
>> but nothing seems to work.
>>
>> The executable is on the top directory in the build directory.
>> The filepath is defined and used in a class in ./src directory.
>>
>> I am not sure how to fix this or which path to use?!
>>
>> Any advice is appreciated.
>>
>> Thanks
>>
>> Benjamin
>> ___
>> 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
>>
>> 

___
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


Re: [CMake] how to specify dependencies out of the source tree?

2011-01-26 Thread Michal Turlik
I thank you so much Eric,
However I managed this thing and obteined the expected result by writing 
something similar and then including it in my root CMakeLists.txt:

- util lib dependency -
# -*- Makefile -*-

IF(BUILD_STANDALONE)

  project( util_lib_pro )

# compatibility issues
  cmake_minimum_required( VERSION 2.6 )
  mark_as_advanced( CMAKE_BACKWARDS_COMPATIBILITY )

  include( "$ENV{CMAKE_ADDITIONAL_MODULES_DIR}/CommonRules.cmake" )
  include( "Project.cmake" )

  set(UTIL_SOURCES ByteArray.cpp command.cpp Config.cpp Logger.cpp
   StringUtils.cpp Time.cpp Guard.cpp)

ELSE(BUILD_STANDALONE)

  set(_UTIL "$ENV{COMMON_INCDIR}/util")
  #set(CMAKE_SOURCE_DIR ${_UTIL} ${CMAKE_SOURCE_DIR})

  set(UTIL_SOURCES ${_UTIL}/ByteArray.cpp ${_UTIL}/command.cpp 
${_UTIL}/Config.cpp
   ${_UTIL}/Logger.cpp ${_UTIL}/StringUtils.cpp 
${_UTIL}/Time.cpp
   ${_UTIL}/Guard.cpp)

ENDIF(BUILD_STANDALONE)

# target
set(util_LIBRARIES util)
add_library(${util_LIBRARIES} ${UTIL_SOURCES})


--- On Wed, 1/26/11, Eric Noulard  wrote:

From: Eric Noulard 
Subject: Re: [CMake] how to specify dependencies out of the source tree?
To: "Michal Turlik" 
Cc: cmake@cmake.org
Date: Wednesday, January 26, 2011, 12:44 PM

2011/1/26 Michal Turlik 
>
> Hi all
> I am trying to build and link against a dependency out of the source tree.
> I tried to arrange a custom target/command combo but it did not work.
> Could someone help me with this?
> What I really need is how to let cmake and make be correclty launched for 
> such an out of tree dependency before it would be linked with my application.
> thank you so much

Did you have a look at ExternalProject_Add from ExternalProject module?

see:
cmake --help-module ExternalProject


--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



  ___
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

Re: [CMake] Out-of-source build and access to data

2011-01-26 Thread Michael Wild
Look at these two documents:

http://doc.trolltech.com/4.1/qt-conf.html
http://doc.trolltech.com/4.1/qlibraryinfo.html#location

By creating a qt.conf in your build directory next to your application
you can make your code completely agnostic to the location of your data
files.


HTH

Michael

On 01/26/2011 05:25 PM, Benjamin Kurz wrote:
> ok, sorry, let's make it more real. I cannot disclose much code, but
> it's like this:
> 
> I have a normal Qt application started out of a main.cpp which is
> located in $SOURCE_DIR/src
> In another QWidget also located in $SOURCE_DIR/src I call a function
> which is also declared in $SOURCE_DIR/src
> with something like this:
> loadfile("./data/file1");
> 
> if I build the application in-source it works fine.
> if I build it in a different place, let's say $BUILD_DIR, it does not
> work anymore.
> 
> The executables in both cases are on the top level of $SOURCE_DIR
> (in-source build) or at the top level of $BUILD_DIR (out-of-source build).
> 
> I copy the files with cmake with the following:
> file(COPY ${PROJECT_SOURCE_DIR}/data DESTINATION ./)
> this works fine, the files are copied and are in the same hierarchy as
> in the source tree.
> 
> Maybe it's not even a full cmake question, if so I am sorry for that.
> But somehow I have to tell my code where to find a file when I have an
> out-of-source build.
> 
> Hope that clearified it a bit, and did not make it less understandable. :)
> 
> Thanks so far.
> 
> Benjamin
> 
> Am 26.01.2011 16:12, schrieb David Cole:
>> Send some code for us to look at.
>>
>> If the cwd is where your exe is, and there's a file at "./data/file1"
>> then you should certainly be able to open and read that file with that
>> file name.
>>
>> Maybe your cwd is not what you think it is.
>> Maybe your code changes it somewhere between launching and attempting
>> to open the file.
>>
>> I don't understand where you're using a
>> filepath = "./data/file1"
>> reference? In your source code? In a settings file of some sort?
>> Certainly not in a CMakeLists.txt file since this is not cmake
>> syntax...
>>
>>
>> ??
>>
>> David
>>
>>
>> On Wed, Jan 26, 2011 at 9:54 AM, Benjamin Kurz
>>  wrote:
>>   
>>> Hello everyone,
>>>
>>> Currently I'm using cmake for building my c++/Qt project.
>>> The source directory structure looks like this:
>>> Project
>>> |_ src
>>> |_ include
>>> |_ data
>>>
>>>
>>> Currently I run cmake from the source directory, having an in-source-build.
>>> Now I want to be able to have a complete seperate build folder.
>>> It compiles fine and it runs ok, unless I need access to a file in the
>>> data folder.
>>> Currently I access files like this: filepath = "./data/file1"
>>> But data is of course not available in the build directory.
>>> So I copied the files during the cmake process, which also works fine.
>>>
>>> But when I run the program I get an exception because the file is not found.
>>> I tried a lot of possibilities:
>>> filepath = "../data/file1"
>>> filepath = "data/file1"
>>> filepath = "file1"
>>>
>>> but nothing seems to work.
>>>
>>> The executable is on the top directory in the build directory.
>>> The filepath is defined and used in a class in ./src directory.
>>>
>>> I am not sure how to fix this or which path to use?!
>>>
>>> Any advice is appreciated.
>>>
>>> Thanks
>>>
>>> Benjamin

___
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


Re: [CMake] Improvements for cross-referencing in the documentation?

2011-01-26 Thread Alexander Neundorf
On Wednesday 26 January 2011, SF Markus Elfring wrote:
> > E.g. cmake --help-full.docbook
> > gives you a docbook file, which can then be processed further.
> > The interesting thing is how to get the links into these files initially.
>
> Do you need any intermediate format(s) for the desired data exchange?

Sorry, which desired data exchange ?
I thought this discussion is about adding more markup tags to the cmake 
documentation ?

Alex
___
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


[CMake] CMake Function, how do I pass out strings or lists?

2011-01-26 Thread kent williams
The CMakeLists.txt below illustrates the problem:
-
cmake_minimum_required(VERSION 2.8)
project(testo)

function(set_a_var var value)
  set(${var} ${value})
  message("${var} = ${${var}}")
endfunction()

set_a_var(testo "HELLO!")

message("outside func testo=${testo}")

The output is:

cmake ../CompilerFlags
testo = HELLO!
outside func testo=
-- Configuring done
-- Generating done
-- Build files have been written to: /scratch/kent/CompilerFlags/build
-

I gather from looking in the CMake Modules that you have to set the
variable to be Cached, but won't this result in some cases in the
CMakeCache.txt getting stuffed full of definititions only relevant to
function calls?

Not that I want to, but what if you started computing factorials?
___
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


Re: [CMake] CMake Function, how do I pass out strings or lists?

2011-01-26 Thread Tyler Roscoe
On Wed, Jan 26, 2011 at 11:24:48AM -0600, kent williams wrote:
> cmake_minimum_required(VERSION 2.8)
> project(testo)
> 
> function(set_a_var var value)
>   set(${var} ${value})
>   message("${var} = ${${var}}")
> endfunction()
> 
> set_a_var(testo "HELLO!")
> 
> message("outside func testo=${testo}")

function() creates a new scope, so you need PARENT_SCOPE on the set() in
set_a_var().

tyler
___
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


Re: [CMake] Out-of-source build and access to data

2011-01-26 Thread Alexey Livshits
You can install target and data and then run your program.

2011/1/26, Benjamin Kurz :
> Hello everyone,
>
> Currently I'm using cmake for building my c++/Qt project.
> The source directory structure looks like this:
> Project
> |_ src
> |_ include
> |_ data
>
>
> Currently I run cmake from the source directory, having an in-source-build.
> Now I want to be able to have a complete seperate build folder.
> It compiles fine and it runs ok, unless I need access to a file in the
> data folder.
> Currently I access files like this: filepath = "./data/file1"
> But data is of course not available in the build directory.
> So I copied the files during the cmake process, which also works fine.
>
> But when I run the program I get an exception because the file is not found.
> I tried a lot of possibilities:
> filepath = "../data/file1"
> filepath = "data/file1"
> filepath = "file1"
>
> but nothing seems to work.
>
> The executable is on the top directory in the build directory.
> The filepath is defined and used in a class in ./src directory.
>
> I am not sure how to fix this or which path to use?!
>
> Any advice is appreciated.
>
> Thanks
>
> Benjamin
> ___
> 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
>


-- 
BG,
Alexey
___
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


Re: [CMake] how to specify dependencies out of the source tree?

2011-01-26 Thread Rolf Eike Beer
> I thank you so much Eric,
> However I managed this thing and obteined the expected result by writing
> something similar and then including it in my root CMakeLists.txt:
>
> - util lib dependency -
> # -*- Makefile -*-
>
> IF(BUILD_STANDALONE)

For those project I need that I usually do this without the user need to
do something special by:

IF (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

Eike
___
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


Re: [CMake] cmake config.h

2011-01-26 Thread luxInteg
On Tuesday 25 January 2011 03:32:36 luxInteg wrote:
> On Sunday 28 November 2010 16:03:33 luxInteg wrote:
> > I came across the useful wiki
> > http://www.cmake.org/Wiki/CMake:How_To_Write_Platform_Checks
> 
> I need '1's in config.g and I dont know how these are generated.
> For gsl  This the cmake output:-
> 
> -- Looking for sys/types.h
> -- Looking for sys/types.h - found
> -- Looking for sys/stat.h
> -- Looking for sys/stat.h - found
> -- Looking for stdlib.h
> -- Looking for stdlib.h - found
> -- Looking for string.h
> -- Looking for string.h - found
> -- Looking for memory.h
> -- Looking for memory.h - found
> -- Looking for strings.h
> -- Looking for strings.h - found
> -- Looking for inttypes.h
> -- Looking for inttypes.h - found
> -- Looking for stdint.h
> -- Looking for stdint.h - found
> -- Looking for unistd.h
> -- Looking for unistd.h - found
> -- Looking for dlfcn.h
> -- Looking for dlfcn.h - found
> -- Looking for vprintf
> -- Looking for vprintf - found
> -- Looking for memcpy
> -- Looking for memcpy - found
> -- Looking for memmove
> -- Looking for memmove - found
> -- Looking for strdup
> -- Looking for strdup - found
> -- Looking for strtol
> -- Looking for strtol - found
> -- Looking for strtoul
> -- Looking for strtoul - found
> -- HAVE_EXIT_SUCCESS_AND_FAILURE
> -- Looking for cos in m
> -- Looking for cos in m - found
> -- HAVE_DECL_FEENABLEEXCEPT
> -- HAVE_DECL_HYPOT
> -- HAVE_DECL_EXPM1
> -- HAVE_DECL_ACOSH
> -- HAVE_DECL_ASINH
> -- HAVE_DECL_ATANH
> -- Looking for ldexp
> -- Looking for ldexp - found
> -- Looking for frexp
> -- Looking for frexp - found
> -- Looking for isinf
> -- Looking for isinf - found
> -- Looking for finite
> -- Looking for finite - found
> -- Looking for isnan
> -- Looking for isnan - found
> -- HAVE_DECL_ISFINITE
> -- HAVE_DECL_LOG1P
> -- HAVE_PRINTF_LONGDOUBLE
> -- HAVE_EXTENDED_PRECISION_REGISTERS
> -- HAVE_FPU_X86_SSE
> -- Performing Test HAVE__FPU_SETCW
> -- Performing Test HAVE__FPU_SETCW - Success
> -- Performing Test HAVE_FPSETPREC
> -- Performing Test HAVE_FPSETPREC - Failed
> -- Performing Test HAVE__CONTROLFP
> -- Performing Test HAVE__CONTROLFP - Failed
> -- Performing Test HAVE__CONTROLFP_S
> -- Performing Test HAVE__CONTROLFP_S - Failed
> -- Performing Test HAVE_FPU_INLINE_ASM_X86
> -- Performing Test HAVE_FPU_INLINE_ASM_X86 - Success
> -- HAVE_GNUX86_IEEE_INTERFACE
> -- HAVE_IEEE_COMPARISONS
> -- HAVE_IEEE_DENORMALS
> -- Configuring done
> -- Generating done
> -- Build files have been written to: ~/S_TESTS/gsl-1.14/build
> 
> 
> 
> 
> make fails like so
> 
> ~/sys/infnan.c:98:3: error: #error "cannot define gsl_finite without
> HAVE_DECL_FINITE or HAVE_IEEE_COMPARISONS"
> ~/sys/infnan.c:115:3: error: #error "cannot define gsl_isnan without
> HAVE_DECL_ISNAN or HAVE_IEEE_COMPARISONS"
> 
> I thought I ensured   that  HAVE_IEEE_COMPARISONS  and HAVE_DECL_FINITE 
> and HAVE_DECL_ISNAN  etc   were tested for and  set to 1 in  the config.h-
> generating file (when these were not  not generated by  'standard cmake
> macros)  and hoped that they would be with the latter.  However  there
> were no '1's in the config.h file and  the make failed.  A quick/crude 
> substitute of appropriate '1's   in the said   file and the  make
> progressed.  So how do I ensure that  '1's are set in the  generated 
> config.h  file?
> 
> 

I still have not seen a reproducible way of generating a config.h.in  to 
reflect results of 'platform' checks in cmake. Would a  simple approach of 
generating )dynamically) such a config.h.in  not be useful?

Suppose we were start with an empty  file -call this  config.h.cmake  (for 
instance)

so  to do a  header file check  for example
check_include_file(somefile.h  HAVE_SOMEFILE_H)

if the above is true
use the execute_process()
to add a line  (for example ) like so :-
--
cat>>config.h.cmake<<"EOF"
#define HAVE_SOMEFILE_H  1
EOF
--

then repeat for other checks{and custom checks}
adding compile definitions (to the appropriate CMakeLists,txt file) as 
required

then in the end use configure_file() to transform this file in to the required 
config.h
___
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


Re: [CMake] cmake config.h

2011-01-26 Thread Michael Jackson
I _think_ there are issues with generating a file that is later used by CMake. 
I think. The other issue is that every time you run CMake (by default) that 
file is going to be written, then configured by cmake which will most likely 
mean a larger recompile than might be necessary.

I don't see the problem here. Most projects just have a one-to-one relationship 
between the tests that they perform such as looking for include files, and the 
entries in their configuration file.

 So if you do a test looking for  then you would also have an 
entry in your config.h.in file like this:

#cmakedefine01 HAVE_SYSTYPES_H  @HAVE_SYSTYPES_H@

Yes, this has a large initial "coming up to speed" but once you have it adding 
a few more tests is simple and fast. 

Take a look at http://scm.bluequartz.net/support-libraries/cmpI kind of 
tried what you are doing but ended up with just a bunch of templates that I can 
easily use with new CMake projects that will run all the same tests and create 
the same type of "Config.h" file for each project.
___
Mike Jackson  www.bluequartz.net
Principal Software Engineer   mike.jack...@bluequartz.net 
BlueQuartz Software   Dayton, Ohio

On Jan 26, 2011, at 3:03 PM, luxInteg wrote:

> On Tuesday 25 January 2011 03:32:36 luxInteg wrote:
>> On Sunday 28 November 2010 16:03:33 luxInteg wrote:
>>> I came across the useful wiki
>>> http://www.cmake.org/Wiki/CMake:How_To_Write_Platform_Checks
>> 
>> I need '1's in config.g and I dont know how these are generated.
>> For gsl  This the cmake output:-
>> 
>> -- Looking for sys/types.h
>> -- Looking for sys/types.h - found
>> -- Looking for sys/stat.h
>> -- Looking for sys/stat.h - found
>> -- Looking for stdlib.h
>> -- Looking for stdlib.h - found
>> -- Looking for string.h
>> -- Looking for string.h - found
>> -- Looking for memory.h
>> -- Looking for memory.h - found
>> -- Looking for strings.h
>> -- Looking for strings.h - found
>> -- Looking for inttypes.h
>> -- Looking for inttypes.h - found
>> -- Looking for stdint.h
>> -- Looking for stdint.h - found
>> -- Looking for unistd.h
>> -- Looking for unistd.h - found
>> -- Looking for dlfcn.h
>> -- Looking for dlfcn.h - found
>> -- Looking for vprintf
>> -- Looking for vprintf - found
>> -- Looking for memcpy
>> -- Looking for memcpy - found
>> -- Looking for memmove
>> -- Looking for memmove - found
>> -- Looking for strdup
>> -- Looking for strdup - found
>> -- Looking for strtol
>> -- Looking for strtol - found
>> -- Looking for strtoul
>> -- Looking for strtoul - found
>> -- HAVE_EXIT_SUCCESS_AND_FAILURE
>> -- Looking for cos in m
>> -- Looking for cos in m - found
>> -- HAVE_DECL_FEENABLEEXCEPT
>> -- HAVE_DECL_HYPOT
>> -- HAVE_DECL_EXPM1
>> -- HAVE_DECL_ACOSH
>> -- HAVE_DECL_ASINH
>> -- HAVE_DECL_ATANH
>> -- Looking for ldexp
>> -- Looking for ldexp - found
>> -- Looking for frexp
>> -- Looking for frexp - found
>> -- Looking for isinf
>> -- Looking for isinf - found
>> -- Looking for finite
>> -- Looking for finite - found
>> -- Looking for isnan
>> -- Looking for isnan - found
>> -- HAVE_DECL_ISFINITE
>> -- HAVE_DECL_LOG1P
>> -- HAVE_PRINTF_LONGDOUBLE
>> -- HAVE_EXTENDED_PRECISION_REGISTERS
>> -- HAVE_FPU_X86_SSE
>> -- Performing Test HAVE__FPU_SETCW
>> -- Performing Test HAVE__FPU_SETCW - Success
>> -- Performing Test HAVE_FPSETPREC
>> -- Performing Test HAVE_FPSETPREC - Failed
>> -- Performing Test HAVE__CONTROLFP
>> -- Performing Test HAVE__CONTROLFP - Failed
>> -- Performing Test HAVE__CONTROLFP_S
>> -- Performing Test HAVE__CONTROLFP_S - Failed
>> -- Performing Test HAVE_FPU_INLINE_ASM_X86
>> -- Performing Test HAVE_FPU_INLINE_ASM_X86 - Success
>> -- HAVE_GNUX86_IEEE_INTERFACE
>> -- HAVE_IEEE_COMPARISONS
>> -- HAVE_IEEE_DENORMALS
>> -- Configuring done
>> -- Generating done
>> -- Build files have been written to: ~/S_TESTS/gsl-1.14/build
>> 
>> 
>> 
>> 
>> make fails like so
>> 
>> ~/sys/infnan.c:98:3: error: #error "cannot define gsl_finite without
>> HAVE_DECL_FINITE or HAVE_IEEE_COMPARISONS"
>> ~/sys/infnan.c:115:3: error: #error "cannot define gsl_isnan without
>> HAVE_DECL_ISNAN or HAVE_IEEE_COMPARISONS"
>> 
>> I thought I ensured   that  HAVE_IEEE_COMPARISONS  and HAVE_DECL_FINITE 
>> and HAVE_DECL_ISNAN  etc   were tested for and  set to 1 in  the config.h-
>> generating file (when these were not  not generated by  'standard cmake
>> macros)  and hoped that they would be with the latter.  However  there
>> were no '1's in the config.h file and  the make failed.  A quick/crude 
>> substitute of appropriate '1's   in the said   file and the  make
>> progressed.  So how do I ensure that  '1's are set in the  generated 
>> config.h  file?
>> 
>> 
> 
> I still have not seen a reproducible way of generating a config.h.in  to 
> reflect results of 'platform' checks in cmake. Would a  simple approach of 
> generating )dynamically) such a config.h.in  not be useful?
> 
> Suppose we were st

Re: [CMake] how to specify dependencies out of the source tree?

2011-01-26 Thread Michal Turlik
ehi nice!
thanks

--- On Wed, 1/26/11, Rolf Eike Beer  wrote:

From: Rolf Eike Beer 
Subject: Re: [CMake] how to specify dependencies out of the source tree?
To: cmake@cmake.org
Date: Wednesday, January 26, 2011, 7:05 PM

> I thank you so much Eric,
> However I managed this thing and obteined the expected result by writing
> something similar and then including it in my root CMakeLists.txt:
>
> - util lib dependency -
> # -*- Makefile -*-
>
> IF(BUILD_STANDALONE)

For those project I need that I usually do this without the user need to
do something special by:

IF (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

Eike
___
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



  ___
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

[CMake] Macro to turn list of librarys into list of dirs?

2011-01-26 Thread Jeremy Selan
Hello!

I have a real newbie question here.  It's possible this was already
answered, but I tried searching the archives and could not find
anything.

I have an application that links to a few libraries, some of which are
in the system install locations and some of which aren't.
I would like the rpath for some of the targets, when installed, to
include only the non-system installed paths.

I played around with using INSTALL_RPATH_USE_LINK_PATH, which almost
does what I need but also includes things in the system path. I then
looked into filtering this rpath based on
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES, but based on other threads
this appears to be ill advised.

As an alternative, it now seems sensible to explicitly craft the
INSTALL_RPATH with just the locations I want to include, but
unfortunately I dont have the directory names.  Instead, I only a
string containint the list of .so library locations.

Does anyone know a macro (or builtin function), that given a variable
with a list of full library paths, will return a list of directories?
The implementation of INSTALL_RPATH_USE_LINK_PATH must be doing the
equivalent internally...

(python psedocode):
mylibraries = [ "/a/b/c/d", "/x/y"]
mydirs = [os.path.dirname(s) for s in mylibraries]

If I'm going about this the wrong way and anyone has suggestions on
how to make the process simpler, please let me know as well.

Thanks!

-- Jeremy
___
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


Re: [CMake] Improvements for cross-referencing in the documentation?

2011-01-26 Thread SF Markus Elfring

Am 26.01.2011 17:44, schrieb Alexander Neundorf:

On Wednesday 26 January 2011, SF Markus Elfring wrote:

E.g. cmake --help-full.docbook
gives you a docbook file, which can then be processed further.
The interesting thing is how to get the links into these files initially.


Do you need any intermediate format(s) for the desired data exchange?


Sorry, which desired data exchange ?


A source format will be converted to a different file format and the conversion 
result will be distributed to the users, won't it?




I thought this discussion is about adding more markup tags to the cmake
documentation ?


I'm sorry. - Have I overlooked in the CMake module documentation that tags are 
already supported?


Regards,
Markus
___
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