[CMake] Detailed graphviz graph?
Jan Wielemaker
jan at swi-prolog.org
Sat Oct 6 12:15:31 EDT 2018
On 03/10/18 09:53, Eric Noulard wrote:
>
> - I have an ordinary executable target `swipl`
> - To run, this requires a boot file `swipl.prc` that is created
> by calling `swipl -b ...`
>
>
> Hum... I don't get it.
> For running? creating? target "swipl" you need to run it?
> There is a chicken & eggs problem or I misread what you said?
>
> - I'd like to run `swipl` for creating a library index file.
>
> So, these targets need to be built in the order above. It turns
> out that sometimes step 3 runs before 2 completes. At least, this
> happens on MacOS using cmake 3.11.2. So far I haven't seen it on
> Linux (where I use 3.10). The definition goes like this:
>
> add_custom_command(
> OUTPUT swipl.prc
> COMMAND swipl -O -b ${SWIPL_BOOT_ROOT}/init.pl <http://init.pl>
> DEPENDS swipl ${SWIPL_BOOT_FILES}
> )
>
> add_custom_command(
> OUTPUT ${PL_LIB_INDEX}
> COMMAND swipl -f none -g
> "\"make_library_index('${SWIPL_LIBRARY_ROOT}')\"" -t halt
> DEPENDS swipl.prc ${PL_LIB_FILES_ALL}
> )
>
> add_custom_target(prolog_products ALL
> DEPENDS swipl.prc ${PL_LIB_INDEX}
> )
>
> The first specifies building swipl.prc, the second the index
> file and the custom target ensures the default build will
> create both files. I don't see what is wrong and a visual
> dependency graph might reveal this ...
>
>
> Are those three add_custom_xxx in the same directory?
> DEPENDS for custom_xxx do not cross directory.
So this was not the problem. The problem was that on the Mac I had build
the system before using the autoconf/make suite, which had created
`swipl.prc` in the source tree. Now, this is the second time I've been
fooled by this:
If a custom command has a DEPENDS, this points at the
CMAKE_CURRENT_SOURCE_DIR if the file exists there and at the
CMAKE_CURRENT_BINARY_DIR otherwise. This makes sense, but
easily leads to things that are hard to figure out ...
Thanks. In particular for pointing at Ninja's tools for figuring out
dependencies.
Cheers --- Jan
More information about the CMake
mailing list