I'm trying to add an Automake project as an external project.
The Automake configure script (usually run with ./configure
) contains a relative path to a resource file. The file is found when I run configure manually, because my working directory is in the source directory. However, when I run configure
with the ExternalProject_Add
, it can't find the resource file because the working directory is CMAKE_CURRENT_BINARY_DIR
.
ExternalProject_Add(zlib
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/configure
BUILD_COMMAND make)
How can I set the working directory for the configuration step so that the config script finds the required files?
In ExternalProject_Add
configuration step is performed with build directory (BINARY_DIR option) being current, so you may set this option:
ExternalProject_Add(...
BINARY_DIR <dir>
...
)
For in-source builds (when build directory is the same as source directory), BUILD_IN_SOURCE option could be used as alternative to set BINARY_DIR option:
ExternalProject_Add(...
BUILD_IN_SOURCE 1
...
)
More info see at ExternalProject documentation page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With