[Cmake] out of source builds
David Somers
dsomers at trevezel.com
Mon Aug 2 17:54:14 EDT 2004
Hi Brad,
> > I'm probably doing something fundamentally wrong, so any help
> appreciated.
As I thought... it was me ;-)
>
> Doing an out-of-source build requires no special support in your
> CMakeLists.txt code. They are a fundamental feature of CMake. When you
> run CMakeSetup.exe, the dialog has two entries:
>
> "Where is the source:" and "Where to build the binaries:"
>
> Just put the source tree in the first entry and whatever other directory
> you want in the second entry. The source tree will be left completely
> untouched and the build tree will have all the intermediate files.
Ah.
Great. I just managed to get it to do all that from the command... next
step... automated nightly builds :)
>
> EXECUTABLE_OUTPUT_PATH just puts all the executable targets into a
> single directory instead of each executable being put in the build tree
> path corresponding to the source tree path of the CMakeLists.txt file
> that contained the ADD_EXECUTABLE command.
>
> CMAKE_CURRENT_BINARY_DIR is a read-only variable for the path to the
> directory containing the CMakeLists.txt file that evaluates the variable.
Ah, read-only. That explains a lot.
>
> > (also, I tried using
> > SET_TARGET_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/preproc.c PROPERTIES
> > DEFINE_SYMBOL "_POSIX_" ) to set a preprocessor definition on a specific
> > file, but that seems not to work).
>
> preproc.c is a source file, not a target. Use
> SET_SOURCE_FILES_PROPERTIES with the "COMPILE_FLAGS" property to add a
> "-D_POSIX_" flag.
OK. That now work's just fine :-)
For custom commands, is it possible to get it to issue multiple commands, or
do I have to generate a batch/cmd file then execute that to do the multiple
commands?
BTW, I thought I saw somewhere that there was a file you could use to
override the settings in the cache...
Cheers,
David.
More information about the Cmake
mailing list