I have a third party library with autotools project. I want to use ExternalProject_Add to build the library.
This can be done the following way:
ExternalProject_Add(project_lib
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/configure --prefix=${LIB_OUTPUT}
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build
)
Now the problem is that I need to pass an environment variable to configure
but I cannot find a way to do it.
In the console I would do it the following way:
CPPFLAGS="-fPIC" ./configure --prefix=output
Is there a way to pass CPPFLAGS="-fPIC"
env to the configure
with ExternalProject_Add/CONFIGURE_COMMAND
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…