[CMake] Avoid nested cmake invocation taking parent's info.
Óscar Fuentes
ofv at wanadoo.es
Sun Nov 9 16:24:45 EST 2008
While cross-compiling, I'm trying to avoid depending on previously built
executables, that is, the cross-compile build should create the native
utilities it needs. For this, I'm trying
execute_process(
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
)
where CX_NATIVE_TG_DIR is a new directory where the native build is
performed. Later,
add_custom_command(OUTPUT ${LLVM_TABLEGEN}
COMMAND ${CMAKE_BUILD_TOOL} -C ${CX_NATIVE_TG_DIR}/utils/TableGen
COMMENT "Building native TableGen...")
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN})
The problem is in execute_process. The cmake process created by it is
taking variable values from the enclosing cmake, so it uses the same
compiler, configure variables, etc.
How can this be avoided? I want the nested cmake to work as if the
enclosing cmake didn't existed.
--
Oscar
More information about the CMake
mailing list