[Qt-interest] which build tools to use?
Pau Garcia i Quiles
pgquiles at elpauer.org
Sat Dec 5 10:22:20 CET 2009
On Sat, Dec 5, 2009 at 3:37 AM, Gordon Schumacher <gordon at rebit.com> wrote:
> For those about to argue against my claims about CMake, I offer you
> three challenges, from easiest to hardest:
> 1) What's the difference between "macro()" and "function()", and what
> are all the effects of that difference? (And... where did you find
> that information?)
macro() just does a text replacement, it'd be like a #define in C
function() is a true function call, i. e. it jumps to other section of code
Where did I find that information? In the CMake docs:
$ cmake --help-command macro
[...]
Note that the parameters to a macro and values such as ARGN
are not variables in the usual CMake sense. They are string
replacements much like the c preprocessor would do with a macro. If
you want true CMake variables you should look at the function command.
> 2) How do you use ExternalProject_Add() - particularly if you want to
> invoke it against an already-extant local directory? (And again...
> how did you find out?)
$ cmake --help-module ExternalProject
[...]
ExternalProject_Add(<name> # Name for custom target
[DEPENDS projects...] # Targets on which the project depends
[PREFIX dir] # Root dir for entire project
[LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines
[TMP_DIR dir] # Directory to store temporary files
[STAMP_DIR dir] # Directory to store step timestamps
[...]
> 3) How should you set things up if you need to be able to use more
> than one build of a given library - say, Qt4 - within a single project
> hierarchy? For example, project A needs to build against Qt build A,
> and it needs to invoke "add_subdirectory(B)" where B needs to build
> against Qt build B.
Do you mean two builds as in Qt 4.4 and Qt 4.5? Or two builds as in Qt
4.6.0 release vs Qt 4.6.0 debug?
You cannot do either of that easily[*]. Can you do that with qmake?
Visual C++? (I'd say it's not possible) Further, what's the point of
that? If you have two projects which need to be built against two
different Qt builds, you should have two separate projects with two
separate build directories.
[*] You can if you "reset" the Qt-related variables in the
CMakeLists.txt in project B:
set( QT4_FOUND FALSE )
set( QT_QMAKE_EXECUTABLE "" )
...
find_package( qt4 VERSION 4.5 EXACT COMPONENTS QtCore QtNetwork )
I've never tested that and it will probably need some adjustments, but
that might work. I still don't see the point of it. though.
> Bonus points if you can make cache variables from
> B propagate upward so that you can still configure them from the top
> level.
To propagate variables, use set( ... PARENT_SCOPE ). Again:
$ cmake --help-command set
[...]
If PARENT_SCOPE is present, the variable will be set in the scope
above the current scope. Each new directory or function creates a new
scope. This command will set the value of a variable into the parent
directory or calling function (whichever is applicable to the case at
hand).
[...]
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
More information about the Qt-interest-old
mailing list