[CMake] Re-executing CMake from the Makefile.

Óscar Fuentes ofv at wanadoo.es
Tue Aug 26 20:03:41 EDT 2008


[Sorry for the late response. Supposedly, it is vacation here :-)]

Brad King <brad.king at kitware.com> writes:

> Óscar Fuentes wrote:
>> thinking on a two-phase build, something like this:
>> 
>> $ cmake -G "Unix Makefiles" # as llvm-config is not available, the
>> executables are ignored.
>> 
>> $ make # this builds the libs and llvm-config and stops.
>> 
>> $ make # This implicitly invokes cmake, which now can use llvm-config for
>> determining dependencies and build the executables.
>> 
>> It would be a good thing if the second `make' were not necessary.
>
> You can do this in one build by splitting it into two projects in terms
> of CMakeLists.txt file layout. [snip]

What I'm doing now is to invoke cmake from the command that builds the
script:

add_custom_command(OUTPUT ${LLVM_CONFIG}
  COMMAND <... builds the script ...>
  COMMAND cd ${LLVM_BINARY_DIR} &&
${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG ${LLVM_MAIN_SRC_DIR}
  DEPENDS ...
)

where HAVE_LLVM_CONFIG is the variable that says if the script exists.

This works, at least on MSYS/MinGW, and it is simpler than splitting the
project.

> I can provide more help if you need it.

This is very much appreciated, Brad. I have experience dealing with you
long time ago with gcc-xml and seeing your name related to CMake was one
of the main reasons for choosing it.

Thanks,

-- 
Oscar



More information about the CMake mailing list