[CMake] "Pre-configure" step in CMake
Matthäus G. Chajdas
cmake at anteru.net
Wed Sep 23 15:49:12 EDT 2015
Hi,
I'm trying to solve the following the problem: I have a C++ application
and a dependency fetching script. I want to simplify the initial build
such that the following happens: On the first run of cmake, the compiler
ID and version is passed to an external script, which fetches some
pre-build binaries. It then writes a CMake file which contains basically
only set(FOO_INCLUDE_DIR /dep-dir), set(FOO_LIBRARY_DIR /dep-dir)
commands. CMake would then read this file and subsequent find_library
calls would pick up the values from this new CMake file. The idea is
that "actual" build is dependent on this first dependency step, but it's
already within the CMake framework so I can grab the compiler info and
other build info.
The obvious problem is that while I can easily run the external script
by using configure_file, and have a custom target that does the
dependency fetching and CMake configure file generation. But I don't see
an easy way to get CMake to make the "rest of the project" depend on
that configure file. How can I make such a "two-stage" build with CMake?
Cheers,
Matthäus
More information about the CMake
mailing list